Model View Controller (Legacy Mix)
© 2003 James Dempsey
Model View
Model View
Model View Controller
MVC’s a paradigm for factoring your code,
Into functional segments so your brain does not explode.
To achieve reusability, you gotta keep those boundaries clean,
Model on the one side, view on the other, the controller’s in between.
Model View
It’s got three layers like Oreos do
Model View Creamy Controller
Model objects represent your application’s raison d’être
Custom objects that contain data, logic, and et cetera
You create custom classes in your app’s problem domain
Then you can choose to reuse them with other views
But the model objects stay the same
You can model a throttle and a manifold
Model the toddle of a two year old
Model a bottle of fine chardonnay
Model all the glottal stops people say
Model the coddling of boiling eggs
You can model the waddle in Hexley’s legs
Model View
You can model all the models that pose for GQ
Model View Controller
View objects tend to be controls used to display and edit
Cocoa’s got a lot of those well-written to its credit
Take an NSTextView hand it any old Unicode string
The user interacts with it, it can hold most anything
But the view don’t know about the model
That string could be a phone number or the works of Aristotle
Keep the coupling loose
And so achieve a massive level of reuse
Model View
All rendered very nicely in Aqua blue
Model View Controller
You’re probably wondering now
You’re probably wondering how
Data moves between model and view
The controller has to mediate
Between each layer’s changing state
To synchronize the data of the two
It pulls and pushes every changed value
Yeah.
Model View
Mad Props To The SmallTalk crew
Model View Controller
Model View
It’s pronounced ‘oh-oh’, not ‘ooh-ooh’
Model View Controller
There’s a bit more to this story
A few more miles upon this road
Well, nobody seems to get much glory
Writing the controller code
Well the model’s mission critical
And gorgeous is the view
Well I might be lazy
But sometimes it’s just crazy
How much code I write is just glue
And it wouldn’t be so tragic
But the code ain’t doing magic
It’s just moving values through
And I wouldn’t be so vicious
But it gets so repetitious
Doing all the things controllers do
And I wish I had a dime
For every single time
I sent a text field -stringValue
Model View
How’re we gonna deep-six all that glue?
Model View Controller
Controllers know the model and view very intimately
They often use hard-coding
Which can be foreboding
For reusability
But now you can connect
each model key that you select
To any view property
And once you start binding
I think you’ll be finding
less code in your source tree
And I know I was elated
By the stuff they automated
And the things you get for free
And I think it bears repeating
All the code you won’t be needing’
When you hook it up in IB
Model View
It even handles multiple selection too
Model View Controller
Model View
Hope I get my G5, before you
Model View Controller
The original version of Model View Controller debuted at WWDC 2003 along with the introduction of Cocoa Bindings. In this initial version, the last two verses focus on the binding capabilities in Interface Builder (IB) and the reduction of code required to push and pull values.
The track Model View Controller (Legacy Mix) recreates the debut performance in a studio setting using the original lyrics and acoustic guitar performance style.
( OS X )
Vocals: James Dempsey
Guitar: Gordie Freedman
Music and Lyrics: James Dempsey
Recorded and Produced by Russell Bond at HowlingPoint Studios