ClickAider
You are currently browsing the Bogle’s Blog weblog archives for the day Monday, November 30th, 2009.

Skinny controllers, fat models and Cocoa

Skinny controller, fat model is a good design principle not just for Rails, but for client apps in MVC frameworks like Cocoa.

I think it’s not uncommon, though, for client apps to have fairly anemic models, to the detriment of reusability. For example, I recently worked with an open source module that was in general very well written, but which made it challenging to reuse to underlying parsing logic.

Why this tendency for skinny models? In part, this might because client apps are UI-centric and this ends up being reflected in the design of the code. Even Apple’s naming conventions (e.g. DetailViewController) emphasize the controller and view at the expense of the model.

The lack of a full-fledged read-eval-print loop in Objective C (akin to the Rails console) also makes it inconvenient for developers to exercise fat models. MacRuby has potential to provide an interactive console for Objective C models, and could perhaps be integrated with Xcode to allow me to bring up a console on any app.