Milos Zikic - Personal site, sharing thoughts about startups, products and engineering

PureMVC vs Cairngorm

By now I have developed Flex applications without using any mvc framework and now I decided to take a look at what is offered after hearing a lot of Cairngorm. As I have seen Cairngorm has a lot of resources on the internet but I didn't like the documentation that is provided with it. It is outdated and I can say that there are no documentation for new relase of Cairngorm. This was very discouraging for me and I found another framework that was very promising. That one is PureMVC. I then tried to implement a simple application that authenticates a user using both frameworks to make a comparison.
Both frameworks present a good MVC pattern implementation but after testing both of them I find PureMVC as a better solution. Here are quick pros and cons on both.

Cairngorm


pros:
- it is developed and used by Adobe consulting
- it has a lot of resources on the internet
- probably most developers are familiar with it

cons:
-
singletons are referenced everywhere
- it doesn't follow don't repeat yourself pattern


The biggest disadvantage for Cairngorm is because you have to write a lot of code and repeat things and you can easily make your system bug open. For instance for implementing the Login application you have to write (following best practices): LoginControl, LoginEvent, LoginDelegate, LoginCommand,and LoginService (if you use some RPC service to get the data). This is a lot of code that we don't need it. It separates application logic but add extra data that we don't need. PureMVC has much better model.

PureMVC

pros:
- it is lightweight framework
- it is written as an Flash, Flex and AIR framework so you can use it everywhere
- it is very well documented
- samples you can find on the official site are enough to get you started
- Cliff Hall (author) is actively working on it and working on educating people

cons:
-
it is hard to find resources beside the ones on the official site.

By following the PureMVC Best Practices your code becomes much cleaner and easy to extend. PureMVC uses Notifications instead of Events (also the use ov events is possible) which are much easer to use (you don't need to create your own notifications which is mostly the case with events). For the same job mentioned above you need to implement: LoginMediator, LoginProxy and optional (LoginCommand and LoginService). So as you can see a lot less work and the code is very clean and easy to maintain.

Considering the learning curve both frameworks have the same complexity and it is not so hard for someone to switch from one to another.

Conclusion

It is important for every developer to be familiar with MVC pattern and it doesn't specially matter which framework you choose. I personally choose PureMVC as much better solution to suite my needs and I would recommend it. This product is still young and awaits community adoption that will come very soon. Concepts and the model behind PureMVC are better and makes the development process much easer. I would recommend to read the documentation found on PureMVC site to everyone. So PureMVC is a definite winner.

There is also a very good presentation that you can find here.
Their conclusion is also that PureMVC is better framework to use. The guys also made one simple example to show you the differences between using both frameworks.


Share this post