Uncategorized - Written by Niels on Thursday, December 14, 2006 22:48 - 2 Comments

Model(Locator), easy way to manage your data

After a hard day of work, where we overcome some problems I focused some more on the architecture of our application. After Raymond blogged some examples about bindings and events, I’ll put some design patterns against it.

So today I made an example of a Model. This is one pattern of the Model-View-Controller pattern. With the Model you can locally store and access your data. I also named it ModelLocator, because frameworks like Cairngorm and ARP also use this name.

So take a look at my example, i’ll hope you’ll understand how useful a Model can be. Also you can see how I’m starting to build my structure in Flex 2.

Next on my todo list is building a Controller. Then the MVC pattern will be complete. Also take a look at the Cairngorm framework. This Flex 2 framework is also based on the MVC pattern, but got many more features.

Model example | source



technorati tags:, , , , , , ,

Popularity: 27% [?]



2 Comments

You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

Gerben Robijn
Dec 15, 2006 10:41

Hey Niels,

You are on the right way with this. And I know this is supposed to be a simple example but I like to add some comment on it.

First thing: I wouldn’t set variables in your model. I would have given the Model 2 functions, setData() and getData(). Those functions can fill dictionary in your model. The Dictionary is a handy tool in which you can place attributes under a certain “key”.

Second thing I would do is incorparate the valueObjects in the model. So setting and getting the valueObjects goes through the Model. This is handy because a ValueObject is also a storage for data but it is also used in communication with the server. So you can send your ValueObject to a server function simply by getting them through the model.

Hope this is a bit usefull for you.

Good luck!

Niels
Dec 15, 2006 10:59

Yes this was a simple example, just to explain the advantages of a Model. But you’re totally right that you can implement other features to it like Dictionary and ValueObject. I also refered to the Cairngorm and ARP framework, where some of these features are implemented.

Maybe you can post an article sometimes about an advanced ModelLocator?

Leave a Reply

Comment

Most Popular Content

Flex - Feb 25, 2008 20:11 - 7 Comments

Rotating arround 3D object in Away3D

More In Technology


Usability - Feb 6, 2008 17:39 - 5 Comments

10 Great articles about RIA (Flex) usability

More In Interaction Design


NabAIR - Feb 27, 2008 2:04 - 5 Comments

NabAIR v0.1: Update to AIR 1.0

More In Projects