Session Facade, meet Business Delegate and his friend Service Locator…
September 27, 2007
A general introduction: The Session Facade enterprise design pattern allows you to create a clean, well-defined interface to complex and/or composited business objects. The Service Locator is an object that gives you a one-stop shop for all your service needs. It holds a reference to all of your services whether they are Remoting, web services, http service calls or other external resources. The Business Delegate is a layer of separation between the Service Locator and the control (command) code, which is very helpful in Flex as it’s an excellent place to setup your responders to the asynchronous calls that you will make and handle service problems.
Facades
The Facade pattern is widely used and usually without notice… Read the rest of this entry »
Cairngorm: MVC & the distributed client…
September 21, 2007
Some say that Flex, due to it’s natural separation of interface and server, gives you the freedom from the tedium of working with MVC. Well, ok, I have an opinion on that like everything else…
Flex is awesome, and it does many things, but facilitating laziness is only a superficial benefit. Sure you may start building Flex apps with little to no design pattern influence and you may design a complex Flex application that is so removed from the server-side logic that you feel justified in your decision to use “the quicker, the better coding”. I have done this myself. But all of the original rules apply (but with built-in benefits). Read the rest of this entry »
:: guest.booq 1.5 ::
September 20, 2007
:: guest.booq 1.5 :: With a lot more meat to it, here is the next iteration in the guest.booq series. I will be blogging about the methodology as time permits… hopefully someone enjoys.
:: guest.booq ::
September 16, 2007
Ok, so I’m just spicing up a lame name with punctuation (that’s always a bad sign) but I wanted a little more then a hello world type application.
: guest.booq : here it is. This is about the most simple application using Cairngorm you will probably find. There are no fancy effects or transitions and the form isn’t saving to the database yet, but I wanted to get a simple listing/drill-down project up for preview. In the coming days I’m going to add functionality to this same interface to show you how easy it is to extend and alter with Flex and ColdFusion.
Some things to note: The View is being controlled by a ViewModel and the fields are bound to data model objects in the ModelLocator (another solid denterprise design pattern) . The Services are registered as RemoteObjects in the Services.MXML a very clever implementation of the ServiceLocator design pattern offered by Cairngorm.
I hope to get the users editable in a day or so (possibly changing jobs so I’m sorry if it takes longer). Eventually I hope to consume some third-party services, get some Stock Ticking maybe weather, Account management, usage tracking… all kinds of high-hopes for this little jewel!
Servicing so many…
September 14, 2007
ColdFusion CFCs are gods gift to web development. Yes, there are security concerns, but with a good design you have at your disposal a tool for creating an interface, web method, web service, well defined objects and more. I love to create a Service Layer and connect a Flex Application to it because I know how much work I’m not doing.
My service layers are simply interfaces (as I believe most are). No logic really, just a remote interface to the business layer and some security. If I’m writing a external app there are more considerations than an internal. The external remote service calls are wrapped up in a RequestDTO Object of some kind and they payload a security context dto of some kind. In this case the Service Layer will be breaking up the composite DTOs and accessing various BI calls to complete a process. This is a pattern called Session Facade and it relies heavily on the choice of DTO design.
If I didn’t explain the importance of DTOs then I should have. A Data Transfer Object (sometimes called ValueObject) is an object defined by its use more then by the pieces of data that make it up. A ShoppingCartDTO will have an array of Items, a user maybe and various other configurations but the shopping cart looks nothing like that in the database (or even the abstraction layer). The Services layer is going to deal with incoming requests, received as DTOs and interact with the BI layer passing along DTOs and getting DTOs back. What is the difference between the DTOs and DAOs? Well with EJBs sometimes there is no difference (not a good design to me). Mostly the difference is in simplifying the object to work for the UI and the services layer without carrying around anymore information then necessary. A DTO also gives you the opportunity to composite DTOs and configuration properties to transfer a complex set of objects as a single object. Another handy function: it gives Flex (a separate technology from ColdFusion and Java) the ability to use native ActionScript objects as proxies for middleware objects in both directions.
With these DTOs available to Flex as objects, and not just graphs of simple properties – very strict definitions can be written on the Flex side. This fits in very nicely with an MVC framework like Cairngorm. With well defined objects, views can be bound to DTOs instead of having to muddy the waters with hundreds of listeners.
more on a later date (hopefully with examples)…
When will I ever get to Flex?
September 1, 2007
I’m working on it… I want to cover these other important issues about application development before I drop the bomb. And it is… The Bomb…