25.4. I Have To Write How Many Classes To Do That?

I am sure you have noticed from the sample application that doing anything in Cairngorm requires writing several classes. Even the simple features that you created for the sample project required 61 classes using the one-to-one paradigm. You were able to get this down to about 50 classes by combining events and delegates. Regardless of how you are handling events and delegates, as the number of features grows so does the number of classes.

Most programmers are familiar with the "Hello World" application. There is a Cairngorm version of it at http://www.asfusion.com/assets/content/exampleFiles/flex/helloworld_cairngorm/srcview/index.html. This entire application could be done in a few lines of standard Flex code, but it takes eight Cairngorm classes and views to accomplish.

Ending up with several classes to do even something as simple as saying "Hello World" is not unusual in an architectural framework. The same criticism regarding class overload is often leveled at PureMVC.

Remember that the goal of an architectural framework is to provide a defined way of building an application, often to facilitate team development, not to end up with the fewest possible lines of code and classes.

Get Professional Cairngorm™ now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.