Re: Cocoa/Windows parallel dvlpmt
Re: Cocoa/Windows parallel dvlpmt
- Subject: Re: Cocoa/Windows parallel dvlpmt
- From: Chris Hanson <email@hidden>
- Date: Mon, 2 Feb 2004 17:55:42 -0600
On Feb 2, 2004, at 11:19 AM, Erez Anzel wrote:
When my data changes, I typically iterate first through the views;
each view then tells the model to redraw its objects, passing it the
view so that the objects will know the drawing scale etc. (each object
knows its real-world coordinates, not its window coordinates).
One way to build cross-platform code is to implement a modified MVC
architecture, more like an MVCC architecture.
Instead of just
Model <--> Controller <--> View
you have
Model <--> Model Controller <--> View Controller <--> View
with the left half platform-independent (say in C++/STL) and the right
half platform-dependent (say in Objective-C/Cocoa or C#/.NET or
Python/Gtk+ or...).
In this case, what I'd probably do is have the model not embody too
much knowledge about how to draw itself. Rather, I'd leave that up to
a model controller. The model controller iterates through the model
objects it controls, collecting the information necessary to draw them
when asked to draw by a view controller (which has been asked to draw
by a view). The view controller converts this information to whatever
the view needs and the view does the actual drawing.
Obviously you can short-circuit this for efficiency; your "model
controller" might actually wind up conceptually more like just another
model object (a "workspace" or "data set" for example). And you could
also wind up short circuiting this architecture for your particular
application, CAD. It's just a pattern, it's not a template...
-- Chris
--
Chris Hanson <email@hidden>
bDistributed.com, Inc.
Outsourcing Vendor Evaluation
Custom Mac OS X Development
Cocoa Developer Training
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.