A bad, bad boy…

January 19, 2011

Blogging. It doesn’t really work if you aren’t actively doing it… I have been through a ton since the last entry and I hope that this one isn’t a flash in the pan.

So, I love Flex. I’ve been all over with it and covered much ground… that’s when I haven’t been flying through the air or floating on the water. No matter where I was you can bet a project, involving Flex, was on my mind. I’ve moved decidedly and comfortably away from Cairngorm and now use SWIZ Framework. My projects are bigger, meaner and more enjoyable then ever.

I’m in the process of constructing a game using AIR that I hope to deploy multi-channel – this is going to be a wonderfully bloggable journey, hope you join me.


CairngormModule Example

This is in no way a tutorial on Cairngorm… in-fact, the use of Cairngorm here is really rough. This is however an Application, using Cairngorm, that is split into Flex Modules. The important thing is the use of a Cairngorm implementation within the modules. 

For brevity I’m not using services. There are some important considerations with services and delegates. You can easily define the BusinessDelegates in the module package but in the structure I have shown, you must define the services in the main application.

In actual development, I use a custom implementation of ServiceLocator so that each modules can inject their own Service Objects. This gives me the ability to dynamically load modules at run time and makes the configuration stay where it belongs.

I hope that this small example helps people. I will probably move on to the architecture that I use most now, MVP (Model View Presenter).

The new me…

July 29, 2008

Ok, so it’s been a while. I’m sorry to those that were waiting for the cairngorm module examples. I don’t have a lot of time lately and I don’t use cairngorm so much now.

I hope to blog a bit more often now that I have a worspress app for my new iPhone 3G. I will be discussing the MVP pattern in my next few blogs and I will be doing a cairngorm compare and contrast.

If anyone still wants to see some cairngorm module code, let me know.


Cairngorm Modularity…

December 7, 2007

Using modules in Flex isn’t all that difficult to understand. But as I have read on many a blog, using Cairngorm with modules is giving people fits. Well, not me…

You use modules so that you can load a portion of your application (functional or visual) and unload it independent of the main application. You do this (using Flex Builder) by extending mx.modules.Module either in a different project or the same, making sure your component is registered as an application in the properties. This Module Component then can be loaded into your main application (shell app) by use of the ModuleLoader class. Simply set the attribute ‘url’ on the ModuleLoader (which is a DisplayObject) and YourModuleLoaderID.loadModule() and YourModuleLoaderID.unloadModule(). If the module is a visual component it will be loaded wherever you place it. Likewise you can place a non visual module anywhere and reference it by id. This is where the difficulty starts.

Now that you have a loaded module, unless it’s a trivial thing, you are going to want to interact with it. With Cairngorm this is very interesting. All sorts of things can happen when you get an application running with the FrontController and ServiceLocator patterns then you just up and load an entirely autonomous Cairngorm implementation in the same player. So don’t. The interaction between module and shell application is communicated by implementing interfaces. If you are going to be using Cairngorm in the base or shell app, then you need to use IoC (inversion of control) to plug a Cairngorm based module into the shell. Specifically, your module will more then likely be using the FrontController to register events/command pairs and it will need to use the shell app’s ServiceLocator to access services. You can easily create an interface that allows you to pass these two items to the module being loaded and if your like me, you can even extend the Module component to make a lot of things happen in the background.

Read the rest of this entry »

What does Cairngorm do?

October 5, 2007

If you use Flex, then Cairngorm makes your life easier. Cairngorm makes your Flex programming more responsible, easier to maintain and extend and it promotes more efficient teamwork.

But what does it do?

Well, Cairngorm is a library (a compiled flash swf) of classes and interfaces that are plumbed together to allow the programmer to plug-in commands (control logic) and interfaces (views) in an easy, efficient manner. By using Cairngorm you are leveraging hundreds of thousands of hours of developer time figuring out what patterns work best for enterprise applications. The Adobe team used guidelines from the J2EE Enterprise Design Pattern catalog to create a very powerful framework (some say micro-architecture) for Flex distributed applications. This framework is logical so it is easy to learn and more importantly easy to teach.

Cairngorm in the work place: A trilogoy – in four parts… Read the rest of this entry »

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.


The Facade pattern is widely used and usually without notice… Read the rest of this entry »

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 »