MVC Song
애플의 개발자 컨퍼런스인 WWDC 2003에서 Cocoa User Interface Programming 세션 중에 MVC패턴의 이해를 돕기 위해 부른 노래라고 한다.
참고로 Cocoa 프레임웍 위에서 UI가 있는 프로그램을 만드는 과정은 MFC의 그것(UI를 리소스 개념으로 디자인 해서 붙이는)과 비슷하고, 컨트롤들의 이벤트들이 Win32/MFC처럼 메시지로 줄줄 들어오는 식이 아니라 컨트롤이 이벤트핸들러를 포함하도록 설계 되어있는 점이 다르다. (닷넷의 윈폼애플리케이션이나, 볼랜드 델파이(C++빌더)의 VCL의 그것과 매우 유사하다)
저 노래를 부르는 아저씨는 일을 정말 즐기는 것 처럼 보인다 ‘-’
*) 가사 중에 나오는 고유명사들
1. NSTextView - MacOS X의 AppKit 프레임워크에 포함 된 일종의 텍스트박스 클래스. 리치에디트 컨트롤과 유사한 점이 있다. NSText와 NSView를 상속받는 식으로 만들어져 있다.
2. Smalltalk - 객체지향 언어의 효시로 알려져 있는 언어. Cocoa의 구현 언어인 Objective-C나, 자바, 파이썬 등에 영향을 준 것으로 알려져 있다.
3. GQ - 유명한 남성잡지-_-
4. IB - Interface Builder. Cocoa나 Carbon을 위한 UI리소스 디자인을 지원 해 주는 UI작성 툴.
5. G5 - IBM의 프로세서 브랜드. 가사에서는 파워맥 G5를 이야기 하고 있다. 64비트 프로세서로, 듀얼 G5 프로세서를 탑재 한 파워맥이 엑박360 출시 이전 개발툴로 제공 된 적이 있다. 2003년 당시의 최신사양의 맥 정도로 해석하면 되겠다.
Model-View-Controller Song
Lyrics by James Dempsey
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 - It’s got three layers like Oreos do.
Model View creamy Controller
Model objects represent your applications raison d’tre.
Custom classes that contain data logic and et cetra.
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.
You can model a throttle in a manifold,
Model level two year old.
Model a bottle of fine Chardonnay.
Model all the twaddle stuff people say.
Model the coddle in a boiling eggs.
Model the waddle in Hexley’s legs.
One, two, three, four.
Model View - You can model all the models that pose for GQ.
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 knows 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 - All rendered very nicely in Aqua blue
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.
Model View - mad props to the smalltalk crew!
for Model View Controller
Model View - it’s pronouced Oh Oh not Uh Uh
Model View Controller
There’s a bit more on 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 - how we’re gonna deep-six all that glue
Model View Controller
Controller’s know the Model and View very
uahh - 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 bares repeating
all the code you won’t be needing,
when you hook it up in IB.
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.
댓글(2)
