In the previous month I received an task to create a demo application using Parsley Framework & Cairngorm 3. After I finished the demo, I though that it can be usefully to post the application and the sources here. The application is here and sources are here. Also the degrafa version is here.
The application makes a connection to Facebook API, receives the album list of the client logged in on Facebook. Once you click an album the image list is loaded and shown.
There are few presentation regarding Parsley Framework or Cairngorm 3 and this may be helpfull for anyone who is interested and can have a small feedback. At the moment I’ve started the demo I knew some details regarding Parsley Framework and Cairngorm 3(basicly the details shown on their website).
As beginning point for my demo I had two samples: Christophe Coenraets’s Flex application with Parsley Framework and Alex Uhlmann Max Presentation regarding Cairngorm 3.
After I finished the application and sent the demo, I found out about a new presentation made by Joel Hooks regarding Inversion of Control and Dependency Injection using Parsley. After reading his presentation I realize that I didn’t took all the right decisions in my project implementation.
So, next lines will be pros and cons regarding my integration of Parsley & Cairngorm 3.
Pros:
1. IoC and Presentation Model:
Parsley’s IoC integration is very simple and I won’t get in details here. The other three presentations are very good for a person who wants to understand exactly how to do this.
I’ve choose to use the hierarchical aproach of the Presentation Model. Why? Well, choosing the hierarchical or the componentized approach depends on each developer and on the application’s features. I’ve choose to go with hierarchical approach because the features of the demo was fixed and because the complexity of the application was small. But, what I like regarding Parsley and Presentation Model is that, lets presume the specs for my app were changed and I had to add new features(this happens a lot in project lifetime), I could easily go from hierarchical approach to componentized approach by removing the injected PM from MainPresenter and create commands that take all the work from the MainPresenter. This way my views and the rest of the application wouldn’t be disturbed.
2. Validation library:
It was so easily to create a user/password login by using this library. Creating a ValidatorGroup and binding the model, made a validation to be written in less than 4 lines. And this can be very usefull for a project that use lots of forms.
3. Degrafa Framework:
I know that has no connection with Parsley Framework & Cairngorm 3, but I’ve used it to change the background gradient of the application. By removing the background image and using degrafa framework the application got smaller with few bytes, but on a bigger application with a lot of vectorial design this framework can be useful. Also, the quality of the application remained the same.
Cons:
1. Commands:
Not using commands was maby the biggest mistake. Parsley commands are very usefull and after reading Joel Hooks presentation I though that using commands on the demo may improve the application by changing the Presentation Model to componentized approach. This way I could let my app freerly to new features, instead of closing it in a box.
2. Facebook API:
I know that this fact has no relation to Parsley or Cairngorm, but there are a few issues that I had with Facebook API. First of all, the login can’t be made from your application. Even if you have your secret Key and API key, the application is forced to open a pop-up and the user to login on Facebook site. After that, another error may appear if the pop-up is closed before the flex session of API receives the login result. So, if a user is fast enough to see the message “you may close the page” and close it instantly, the flex session of API is not made.
Maybe this could be easier if Facebook could create an embed swf that any application can load and insert it in(like badge.swf or air.swf on AIR installer). This way facebook can be sure that an application will not store clients account and password, and also, the session connection won’t have lacks.
EDIT: There is a nice tutorial where is explained how to open the Facebook login pop-up using a JS wrapper here.
3. Not using too many libraries from Cairngorm 3:
I didn’t use too many libraries because I didn’t know where I could use it. For some libraries there is no description or examples how to use it, and other libraries I didn’t know where to integrate it in my app’s workflow. Maybe in future, after all libraries will be properly documented I will do a new presentation regarding Cairngorm 3.
4. Using a fixed layout
My focus was more on Parsley & Cairngorm integration and less on view part. Please ignore that the application is made on a big resolution and the application is not resizable.
Maybe this are not all the pros and cons regarding my demo, but I hope this can be usefull for someone who will be interested in using any of the frameworks posted above. Also, this presentation is not made to prove that a framework is better than other. I think each developer needs to take the decision to use what frameworks suite better for the project and needs to know at base level almost all the frequintly used frameworks.
Also, I’m happy to receive and update the list of pros and cons from any of you after looking at my demo.