That is a good point... my data is indeed separate from the view, all that needs synchronization is a couple of custom controls, which could perhaps be handled via notifications.

thanks,

c.


On Aug 8, 2008, at 9:56 PM, Graham Cox wrote:


On 9 Aug 2008, at 11:44 am, c. mendoza wrote:

Why do you think you need to do this anyway? If you have a view class just create a new instance of it.


Because the two views should be synchronized

If you need to go out of your way to "synchronise" two views, maybe your design could do with a bit of revision to use better MVC principles. Normally a view wouldn't have state data that required synchronisation. Instead, the (single) model contains the state data and the views just visualise it. When the model changes, the views are redrawn and thus both show the same data.

If you are keeping state data in your view, move it into a model class and use a controller to mediate between the two views and the model. While it seems more complicated at first, it's well worth it because it makes the two-view scenario trivial to deal with. A good rule of thumb is that if you ever need to duplicate or synchronise the same data in two places, your design is wrong.

hth,

Graham

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to