0% found this document useful (0 votes)
53 views15 pages

MVC Song

The document discusses the Model-View-Controller (MVC) paradigm for structuring code. MVC separates an application's data model from its user interface by having three main components - the model, the view, and the controller. The model manages the data and business logic, the view displays the data to the user, and the controller mediates interactions between the model and view. Several examples are provided to illustrate how MVC works.

Uploaded by

ttulayguclu
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
53 views15 pages

MVC Song

The document discusses the Model-View-Controller (MVC) paradigm for structuring code. MVC separates an application's data model from its user interface by having three main components - the model, the view, and the controller. The model manages the data and business logic, the view displays the data to the user, and the controller mediates interactions between the model and view. Several examples are provided to illustrate how MVC works.

Uploaded by

ttulayguclu
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 15

Model View Controller

model: float sales[3][4];

PowerPoint presentation by Cameron Hayne September 2003

controller:

views:

Model View Controller


Lyrics and music by: James Dempsey, Apple WWDC 2003

Model View, Model View, Model View Controller


MVC's the 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 Controller


Model View -- It's got three layers like Oreos do. Model View creamy Controller

Model View Controller


Model objects represent your applications raison d'tre. Custom classes that contain data logic and etcetera. You create custom classes in your app's problem domain,

then you can choose to reuse them with all the views,
but the model objects stay the same.

Model View Controller


You can model a throttle in a manifold, Model a lovely two year old. Model a bottle of fine Chardonnay.

Model all the glottal stuff people say.


Model the coddle in a boiling eggs. Model the waddle in Hexley's legs.

Model View Controller


One, two, three, four. Model View -- You can model all the models that pose for GQ. Model View Controller

Model View Controller


View objects tend to be controls that view 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 words of Aristotle. Keep the coupling loose and so achieve a massive level of reuse.

Model View Controller


Model View -- All rendered very nicely in Aqua blue Model View Controller

Model View Controller


You're probably wondering now. You're probably wondering how, the data flows 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.

Controller: Model: 42 42 42 View: 42

answer = 42

Model View Controller


Model View -- mad props to the Smalltalk crew! for Model View Controller

Model View -- it's pronounced Oh Oh not Ooh Ooh


Model View Controller

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 controller code.


Well the model is mission critical and gorgeous is the view, But I'm not being 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 wish I had a dime

for every single time


I set a TextField's stringValue.

Model View Controller


Model View -- how we gonna deep-six all that glue? Model View Controller

Model View Controller


Controllers know the Model and View very ah -- intimately They often are hardcoding

which is very verboten for reusability.


But now you can connect any value you select to any view property. And I think you'll start binding, then you'll be finding less code in your source tree. Yeah I know I was astounded, - that's not even a rhyme. But I think it bears repeating all the code you won't be needing,

when you hook it up in IB.

Model View Controller


Model View -- it even handles multiple selections too Model View Controller

Model View -- hope I get my G5 before you


Model View Controller Yeah, yeah, yeah. Yeah.

Model View Controller


model: float sales[3][4];

PowerPoint presentation by Cameron Hayne September 2003

controller:

views:

You might also like