views:

98

answers:

1

I have a system that need two representations of the same model, and for simplicity i want to use one model, and not keep multiple models - because than my system will suffer from translation errors (the models will not be compatible) that might cause the system to be faulty.

Does anyone know a good design practice for that problem?

For example lets say i have UserList which contains multiple users. From one hand i want to see the all of my userlists and the users that each of them contains. From the other hand i want to know for each user which are the userlists that he belongs to. I can save this information twice (once from the userlist point of view and once from the user point of view..) but that doesn't sounds like a good practice. Further more, let's say that the userlist has some properties that can be configured by the system view of the model. How do i let the user view of the model know that there was a configuration change in one of the properties (without going threw the userlist and tell each user what was the change,or whether there was a change).

How do i maintain these multiple views of the same model - the system view, and the user view in the same time while prevent the duplication of data and information and the ease of query for the model information and changes in it?

+1  A: 

Go on http://martinfowler.com/eaaDev/index.html :

The list on the right gives access to many Presentation Patterns, with everything explained.


Alternatively, if you use java/Swing, each model can easily be used by several views, so you just follow the regular flow... :-)

KLE