Wednesday, August 27, 2008

FlEX = UI + LOT MORE!

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

MVC with FLEX

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
Ex:view.updateCollection(data:ArrayCollection)

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 adobe.com)

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.

http://livedocs.adobe.com/livecycle/8.2/programLC/programmer/lcds/help.html?content=rpc_remoteobject_2.html

There goes your first java enabled flex project.

Comments welcome!

Will be posting on and soon!

Thursday, May 29, 2008

who is the ideal flex developer? Flash dev or Java dev or DHTML/Ajax dev?

Alright!! I know the topic is a little stupid , May be I should-phrase it to "who should I hire ?"

Whatever it be , I am just trying to figure out who would be my flex developer ??! . Is it the graphics guy Joe who had done numerous animations for web sites based on flash MX, spendign time on the timelines and frames using action script just a little to prevent the headaches that can happen later OR is it the java guy who was creating windows/Desktop applications with java swings and felt miserable with lack of flexibility (Think UI,colors,themes,god looking apps). Thank you sun! OR Is it the web developer who was toiling and moiling with the ugly browser quirks and the so called Ajax hacks and frameworks that are growing at tons per second.

Who would I hire If I had to ?

Well.Lemme try to summarize what command over flex really means and my opinion on who excels in which aspects?


1. OOPs principles
  • Java Guy - It goes without saying that the java guys excels here.The java masters know how to apply a structured approach to problem solving. Picking up somethign like Cairnghorm will be a piece of cake if one is a proper Java developer. The event model is something that all java developers would find to be very very inituitive. Last but not the least, Java guys are almost always familiar with design pattenrs.Though these folks may have a tendency to write really large code, they structure the solution properly!! They Scale.
  • Flash guys - Well ..How Object Oriented is actionscript? Most flash guys of 2000 - 2005 were working with actionscript2.0 which really did not have much to offer from an OO perspective
  • Web Developer - Web developers are so to hacks that they are never really allowed to do oops with javascript . Thanks to lack of Mature Object Oriented aspects in javascript, no web developer really knows to crack a tough problem by breaking it into objects, if not rare.
2. Interface Design
  • Java Guys: These folks are a little dumb here.. They never value the coolness that a tool like flex can bring to ones interface. They like simple interfaces lot more! Though using mxml will be very easy thanks to their familiarity with xml based frameworks like jsf
  • Flash Guys: These folks will harness the power of flash animations to the fullest.just try giving them a login page as a sample. You will fall in love with flex on first sight. :-)
  • Web Developer: These folks can do a decent enough job , but will surely take more time.. Reason. They are so to frameworks like prototype , SCriptaculous that it takes a bit of time for em to get rid of that "div" thing :-)
3. Product Engineering Capablities

  • (Will be continued)

Friday, March 28, 2008

Problems with High end phones

Source: Wikipedia
I switched from a low end nokia 1100 to a much advanced Nokia N72 recently.

Though N series comes power packed with a lot of features, typing SMS on it is a pain.

Why is it that all these high end phones make life difficult for users?? Another bizzare effect of this is that Application developers who want to develop applications that will require a bit of typing.

Say for instance mobile versions of EQO,EBuddy, HeySan..
These clowns had made it so painfull to type for a long time on the mobile...

With the mobile phones market fetting more competitive,
I am sure that the company that makes it easy for one to type sms withiut hurting one's fingers will have an edge..

Not the one that targets to make science fictions come ttue with that little device..

Vengu!

Thursday, March 27, 2008

Flex Interview Questions

A few interview questions on flex,

1. Is it possible to make httpService Requests synchronous?
2. I need to load an image from flickr into my application. Do I need a crossdomain.xml file on flickr?
3. What is the difference between httpService and Data Service?
4. How do you generate random numbers within a given limit with actionscript?
5. Have you built any components with actionscript? If so explain how you did it?
6. How do you implement push on a flex applications?
7.I am going to add images into a tag. How will it resize itself?
8. What is a resource Manager??
9.What are the similarities between java and flex
10. What is the dynamic keyword used for?
11.How do you implement push with flex data services?
12. What are the methods called when a UI component is intialized?
13. How do you implement drag and drop on components that do not support ondrag and ondrop?
14.Can you write to the file system from flex?
15. What is a drag manager?
16 . HOw do you call javascript from Flex?
17. How do you use a repeater?
18. what are three ways to skin a component in flex?
19. How do you use css styles in flex?
20. What is the difference between sealed class and dynamic classes?
21.what is MVC and how do you relate it to flex apps?
22.what is state? what is the difference between states and ViewStack?
23.how does item renderer work? How do I add item renderer at runtime?
24.what keyword allows you to refer to private variables of a class?
25.how polymorphism works on actionscript?
26.how do you overload functions in actionscript?
27.what is dynamic keyword used for?
28.what are sealed classes ?
29 what are runtime shared libraries?
30.What is caringhorm ? how do you use it?Have you worked with Cairnghorn?
31.What keyword allows you to implement abstraction better?
32.What design patterns have you used? in Actionscript and java?

Try to get answers for these.
You can be me :-)

Friday, March 14, 2008

How meebo works? (My guess of how they might be doing it!!)

We all know how useful and good meebo is.

The web based instant messaging client is a big brand now on its own and has been growing exponentially after it received funding a few months back.

Just out of curiosity, I started digging into the possible ways that meebo might have been implemented.

After a few minutes of research I think I have a vague idea of the components involved.

1. At the heart of meebo's backend is the open source API called libgaim which is under the pidgin project now. So technically anything that pidgin can support will be supported by meebo too :-)

2. Wrappers that write to a socket. The libgaim api sends signals that can be registered to callbacks that handle the signals. I believe the signals are being written to a port.

3. Direct Web remoting / Flash based remoting. This is the layer that perfoms the task of the web based client getting the messages that are being written to the socket from the wrappers that listen to gaim signals.

4.A small UI layer with Ajax frameworks like dojo/scriptaculous that gives you that cool look and feel.

Off course there might be hundred of tweaks that meebo would have done , but this I see is the core engine

There you go. :-) If you can do this , you can have your own version of meebo for your company, office.

Thanks,
Venkat