Archive for January, 2007
01-14-2007
Persistent Value Objects
In the constant iterations of change and refactoring my development team has come up with a very in-genous way of using value objects in the Cairngorm Framework. We have created a class called BaseObject.as that is almost an abstract class. It has a function called init that takes an Object as a parameter (had better be an object of its own type). It also has a public method called populate. This function will generate a cairngorm event that calls the backend and actually calls the corresponding populate function on the backend object. BaseObject.as also has function to change the event type for the populate method if you want to create a custom populate command/delegate. BaseObject also lets you set your own callback function. This encapsulates your data work into your valueobject instead of being all over your view / viewhelpers. There is another class that extends BaseObject.as even futher which is called Pobject.as (Persistent Object). This class handles storing, fetching, and removing of a specific persistent object. These Pobjects can be thought of as an object that represents a row in the database.
This way of using value objects cleans up your code immensly. You can basically cut down your number of command objects and delegates to a few classes. Cutting out the number of classes having to be created just to pull data from the db or send it back speeds up development time thus saving money or allowing for further innovation on a project. Any questions or comments on this philosophy would be greatly appreciated.
Posted by Blake Bigelow in Blogroll, Flex 2 | No Comments »