Sunday, July 26, 2009

Does size matter?

Gone are those days where we used to tightly stuff a lot of files & folders - setup's, dvd's copies, music collection and some movies into the 20GB HDDs.... These days everything comes in larger sizes. So is Flash Catalyst Beta 1. I was stunned to see the size of it after installation, (is it still a bug? or for real?) - 5.36GB? Wish the number is wrong... wow...



Wondering why its showing "Adobe Flash Catalyst" instead of "Adobe Flash Catalyst Beta 1", hmm... thats a bug... Icon overriding is also a bug...

Saturday, July 25, 2009

Auto doc snippet generation in IDE's...

What is Auto doc snippet generation? Its a very simple feature that i think should atleast be optionally be provided in every IDE tool to enhance overall project coding experience. Let me describe what this simple feature should do (I am not aware of any tool/plugin which is already available so far)...

     Just as you declare a variable, and just as you are done, ';' should auto generate the doc skeleton, create a //TODO:write comment snippet auto-select it and get you ready to just type what it is supposed to do.

        

    Just as you write a function and as you "}" (close) the function, it should auto generate the doc skeleton, create a //TODO:write comment snippet auto-select it and get you ready to just type what it is suppsed to do. As you change your function signature it should introspect existing doc skeleton and alter the argument types, return types etc. without having to manually go and edit it.

   

    

    Just as you close a loop (ex: for, while etc.), it should auto generate the doc skeleton, create a //TODO:write comment snippet auto-select it and get you ready to just type what the logic is for..

     

    Just as you write an if condition, it should auto generate the doc skeleton, create a //TODO:write comment snippet auto-select it and get you ready to just type what this condition is for..

      

     I've worked on a lot of projects but none of the projects were fully documented. Every developer has his/her own way of writing a piece of code. Even when you have a code monitoring tool, peer code review process, strict code guidelines to follow on every project (which is predominently seen in product based companies than services based companies and a less often in some companies who just want to get things working without having to bother much about spending time in writing code comments), there is always a scope of the code being written is left undocumented. There are some companies who enforce strict documentation on the code written but at the end they see themselves doing just 50-60% of it overall. I would say there are atleast 70% or more of the larger audience who concentrate on putting their brain at work by writing the actual code and get things working and leave their baby code undocumented unintensionally due to other work priorities. Developers may change and a new developer joining in is always targetted to face the tough time with the gaint code. Even the developer who wrote the code 4 months ago doesnt completely remember what's written unless he spends some time by going through the code again.

    How does a fully-documented code look like? Many people like to read the lines of code as they glance it and seeing a lot of comments written due to auto-doc snippet generation sometimes might disturb them. I do agree, but we can always have preference options to show/hide doc snippets, fold/unfold doc snippets.. everything is possible. As the application code grows larger and larger with tons of frameworks out there, the code is crying out loud - "If you dont document me now, i'll kill you or someone in the long run"...

Wednesday, July 22, 2009

Life Cycle Data Services 3 - New !!

With Adobe's showering a bunch of products into beta (almost at the same time), CF9, CFBuilder, FlashBuilder, FlashCatalyst, Flex4, LCDS3... wow..thats a lot.... Yesterday i had a chance to look at the video tutorials posted on the labs for the new lcds 3 beta features. Adobe's Romania team scores high in delivering these server spice into flex. From my LCDS 2.5+ experience, this was really a new ball game. Here are some of the highlights -

  • Model driven development brought into Flex with Fiber (language?)... Model View perspective in flash builder (earlier flex builder), create models from the RDS View connected to db from within flash builder, create services for the operations, generating model driven forms from within flash builder to quick test your model
  • Easy creation of filters from within flash builder
  • Annotations
  • localization, validation, data formats
  • Reliable messaging - this is one of the best features. Having AdvancedChannelSet, AdvancedMessaging This feature ensures that messages sent over the wire do not get dropped out due to network fluctuations (on and off). Before it tries to give you a feedback saying message sending error it does try to resend it for some time (configured) so it gets around the problem of fluctuating networks.
  • Message Throttling - Video streams for bad network are always hit. With this feature, you have more control on how your data messages can be handled with care to ensure to fit it in your network. You have options to pamper the inbound messages and outbound messages. InBound Messages have policy options - ERROR, IGNORE, NONE and OutBound Messages have policy to ERROR, BUFFER, NONE..

Its amazing to see the new developments...

Converting AS Objects to XML and reading the same XML into AS Objects...

One of the requirements i had was to write down the Action Script object returned from the Coldfusion webservice call into a flat xml file. This was a temporary solution i had to provide seamless integration between flex app and AIR app..

I had a huge bunch of query object data returned through CF webservice call and i needed to persist the data into an xml file without having to write a whole bunch of code to navigate to each and every property of the object (introspect)...

    This simple code here lets you write the crude CF returned object into a nice XML

   And this code below converts the XML into an action script object that can be used during your persistence..


Invoking JavaScript from Flex AIR App (in FlexBuilder)

This is with FlexBuilder3. If you have a lot of javascript source files made on another project of yours (presuming to have used another technology like CF, .NET, Java) and you are intending to use those javascript source files while porting to Flex based AIR Application, then here is a sample to load all your javascripts and invoke the functions from With in the Flex application.

"Note: Adobe AIR currently does not support the ExternalInterface class" is clearly indicated in the API. So whats the alternative to this.

The API link for ExternalInterface.as (Search in AllClasses for ExternalInterface.as) also clearly indicates the following are possible:

From ActionScript, you can do the following on the HTML page:

  • Call any JavaScript function.
  • Pass any number of arguments, with any names.
  • Pass various data types (Boolean, Number, String, and so on).
  • Receive a return value from the JavaScript function.

So What we are going to do is "Load a dummy html page carrying links to all the javascript files to be invoked from the Flex AIR Application"...

Step 1: Get your js files into a directory

Step 2: Create a dummy html file and include your scripts as here

Step 3: use <mx:HTML /> tag of Adobe AIR to reference it in your app

Step 4: On Creation complete handler of your Adobe AIR application, load the html file which contains your js files, so you can reference it later on to invoke javascript functions...

Step 5: Use the reference as below and invoke a javascript function from within flex. You can pass arguments to the js function and retrieve return values as well.