On Oct 12, 2009, at 4:27 PM, Ben Trumbull wrote:

but in this case it must draw itself.

No, it doesn't must do anything. Views draw themselves, model objects are state, and controllers are intermediaries.
...
What problem are you trying to solve by knowingly violating the MVC design patterns ?

Hmmm ... must draw itself? No, from a pure MVC approach, I agree with you 100% that not only does it not "must" but it "shouldn't".

However, it's only fair to point out theSketch example - the quintessential example for drawing applications. The STKGraphic class has draw...InView: methods.

For a drawing app, I can see why it might be considered a cleaner design, despite "knowingly violating the MVC design patterns". A "Shape" knows how - and where - to draw itself - just give it a view. I think it's mostly a matter of personal taste and methodology but it certainly isn't "wrong", which I suppose is why it's now one of the few examples left in the developer examples folder in Snow Leopard.

In theory this violates MVC, but in practice this design approach is much easier to understand and maintain (in my opinion, anyway) for a drawing application like Sketch.

This isn't meant to contradict your overall advice, but I do think an application's architecture doesn't have to *rigidly* adhere to any one design pattern to be "good".

--
I.S.

_______________________________________________

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 arch...@mail-archive.com

Reply via email to