Wednesday, August 27, 2008


It infuriates me when I hear people say flex is Just another UI technology.Even the most tech savvy people have no clue what flex can do , but assume that its just about looks .. well good looks.. Though creating a cool UI is a very important part of flex's capablities, it can do much more.. I mean much much more!

Here is a short summary of capabilities that flex can bring to your next application.
  • Consistent behaviour across browsers: How many times have we abused bill gates and his IE team for not being standards compliant when it comes to browser behaviour?? The flash runtime is probably the most matured runtime that can run on a browser. Code once written will never require a change no matter which browser you intend to use it on.Please note that by behaviour I am not trying to mean the look and feel alone.Many times HTML based applications just cant work on all intendedd browsers
  • A stateful client : Flex allows an application to have a stateful client. When a client understands the state of itself , it saves a lot of server memory wasted in maintaining the state.Imagine something like ebay in which millions are logged in and are amidst a chekout process. SERVER MEMORY = MONEY and flex can save lots of it when you build your next web application
  • Real time data: This is something that traditional web applications really suck at and flex is pretty darn good at. Flash supports sockets which is the only way to have the server push data on to multiple clients. For enterprise applications flex data services or cocomo can help one achieve PUSH .. Its just impossible to achieve with plain AJAX. Direct web remoting is an option many developers opt to but one review with firebug says its just as good as polling :-)
  • MVC: Flex plays amazingly well in a system that uses MVC or MVP. Adobe backs up this aspect of flex with great support for "Cairngorm" the mvc micro architecture which is very widely used. PureMVC is another option that one would want to check out.
  • Event Model: Flex works on an event model that will be very very similar for java swing developers. In flex every communication is done via events. What this really means is that your components don't really have to know anything about the callers. True component reuse :-)
  • Multimedia: Youtube got sold for a few billions.. All by leveraging flex/flash multimedia capabilities.
  • Remoting: Flex data services and blaze data services helps you bypass the xml/html layer that makes traditional applications horribly slow. The real magic here is the protocol called AMF that makes your apps render server side data in a whizzy.
  • WEB TO DESKTOP in a minute: Your flex applications can be converted into desktop applications and vice versa in a matter of minutes.. Adobe AIR combines the connectivity of web apps with the responseiveness of desktop! Converting you flex applications to desktop application is a matter of changing the root tag from mx:application to mx:windowedapplication in most cases..
    Checkout adobe air here
  • Compoenent Architecture: Last but not the least the component architecture built into flex is what makes flex what it is. One can opt to deliver components as closed source(think .swc) if required. Flex components do not suffer from DLL hell or the much talked about JAR hell that traditional apps suffer from

Now stop saying flex is just about UI!!!!
As always.. Comments are welcome.. :-)

Sunday, August 24, 2008


There has been a lot of talk about flex being the next generation development tech for enterprise solutions. Whenever one gets to think about the idea of building enterprise solutions , one word can never be ignored "DESIGN PATTERNS". When you think of a MVC implementation with flex Caingorm and pureMVC frameworks are the ones all developement teams will consider.
I havent used pureMVC but worked with Cairngorm and havent felt too good with it. The problem I face with Cairngorm is that there is need to use observers to detect the change in the model. I mean the the view really has no idea when the model it consumes would change.
The problem here is when multiple UI components are trying to detect a change to the model, you have no idea about the order in which the views react. So cairngirm became a sure shot way of getting into trouble for me.

So I had to find other approaches. And a different approach find did I. :-) . Here is a brief description of my little MVC implementation.

  1. Create an interface that acts a contract between the view and the controller(handler)
2. Have the view implement the interface. This helps you create a handler that doesnt need to know much about the view that is consuming it.

Ex: -- > mx:Application implements="com.simplemvc.IsampleInterface"

3.Create a reference to the handler in the view . The handler should also hold a refernce to tghe view. Have something like

Ex:--> handler:SampleHandler id="myHandler" view="{this}" myData="{this.gridData}"

4. Call the methods in handlers/controllers when you need to .
Ex: handler.getData();

5.Have the handler call your remote Object/web service/httpservice and call back the view using the reference

Checkout the source code here

Comments welcome.

Monday, August 11, 2008

How to set Up Flex Builder for JAVA

Quick post on how to set up flex builder for editing and debugging java code in parallel.

You must have flex builder 3 installed for this.

1. Install WTP using Help->Software updates->Find and Install.

2. Create a new flex project .

3. Select the J2ee project type.

4. Select the create a combined flex using WTP option. Click Next

5. Select your tomcat home .

6.Select the location of your flex.war on the next screen. (Note: You can download flex.war and flex data services from

7. Click finish.

Flex builder would have create all the necccessary code structure and xml files create for you

To create a simple remote object project follow this tutorial.

There goes your first java enabled flex project.

Comments welcome!

Will be posting on and soon!