复合设计模式学习笔记-MVC Song
设计模式 复合模式 MVC 策略模式 观察者 组合模式
MVC song
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,
设计模式 复合模式 MVC 策略模式 观察者 组合模式
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
设计模式 复合模式 MVC 策略模式 观察者 组合模式
Model View — hope I get my G5 before you
Model View Controller
Yeah, yeah, yeah. Yeah.
汉语翻译:
复合模式之王--Model - view-controller
模型-视图-控制器
MVC是一种泛型
它构造代码成为功能段,免得你脑袋淤阻
为达到复用,你必须让边界干净
这边是模型,那边是视图,控制器在中间
模型 视图 和夹心饼干一样有三层
模型 视图 控制器
模型 视图 模型视图 模型 视图 控制器
模型对象正是你的应用系统存在的理由
你设计的对象,包含了数据、逻辑和其他
在你的应用领域,你创建定制的类
你可以选择复用所有视图
但模型对象无需改变
你可以建模一部机器,随便什么机器
建模一个两岁小孩
建模一瓶白葡萄酒
建模人们的窃窃私语
建模一些水煮蛋
建模Hexley的蹒跚步履
模型 视图
你可以建模GQ时尚杂志中的模特儿
模型 视图 控制器
视图对象通常是控件,用来显示和编辑
Cocoa也是这样,设计良好,赢得好评
设计模式 复合模式 MVC 策略模式 观察者 组合模式
把任何老的Unicode字符串交给NSTextView
用户可以和它交互,它几乎可以包含任何东西
但视图不知道模型
字符串可以是一个电话号码,或者亚里士多德的文学作品
保持松耦合
达到最高的复用
模型 视图,一切都是水波荡漾的蓝色
模型 视图 控制器
你可能正在纳闷
你可能正在纳闷
模型和视图之间的数据流动
是由控制器居中协调进行
两者之间状态的改变,数据的同步
都是有控制器控制的
控制器负责将每个改变的状态送进送出
模型 视图 对于Smalltalk的人来说
这是最大的支柱
模型 视图控制器
模型 视图,读作“噢噢”,不是“呜呜”
模型 视图 控制器
旅程尚未结束
前方还有道路
编写控制器的人
似乎没有得到掌声
模型的使命很重要
视图的外观很美妙
我或许很懒,但有时却是疯了
我写了多少代码,只为了黏着两者
其实并不惨痛
说穿了代码并没有神奇之处
只是用来搬动值罢了
我无意出言恐吓
这是有声誉的
对于控制器你照做就是了
我真希望能得到一个铜板的奖赏
每次将字符串
送到TextField时
设计模式 复合模式 MVC 策略模式 观察者 组合模式
模型 视图
我们要如何丢弃黏结
模型 视图 控制器
控制器相当熟悉模型和视图
所以常常硬编码来妨碍复用
你可以将模型的键连接到任何视图属性
相关推荐:
- [文秘资料]班长职务辞职报告
- [文秘资料]完美的辞职报告
- [文秘资料]经典的员工辞职报告
- [文秘资料]医院口腔医生辞职报告
- [文秘资料]总经理辞职报告范文四篇
- [文秘资料]超市职员个人辞职报告
- [文秘资料]村妇联主任的辞职报告
- [文秘资料]辞职报告书格式
- [文秘资料]酒店辞职报告简单范文
- [文秘资料]联通的辞职报告
- [文秘资料]2017最新私企员工辞职报告范文
- [文秘资料]2019年度医院基层党组织书记抓党建述职
- [文秘资料]工作时间长辞职报告
- [文秘资料]辞职报告怎么写出来
- [文秘资料]个人能力原因辞职报告
- [文秘资料]网络工程师辞职报告
- [文秘资料]项目部辞职报告
- [文秘资料]缝纫工辞职报告怎么写
- [文秘资料]XXX州委书记述职报告
- [文秘资料]抓基层党建工作述职报告
- (王虎应老师讲课记录)六爻理象思维
- 八个常见投影机故障排除法
- 质量专业综合知识(中级)第一章质量管理
- 煤矿班组建设实施意见
- 我国快餐业与肯德基经营模式的比较与分
- 汽车保险杠模具标准化模架技术工艺研究
- 汽车二级维护作业团体赛比赛规程
- 装卸搬运工安全操作规程
- 高效的工作方法-刘铁
- 依据《生产安全事故报告和调查处理条例
- 2015专业PS夜景亮化效果图制作教程
- 企业劳动定额定员浅析
- 中枢神经系统医学影像学本科五年制第五
- 长城汽车参观探营第三站:研发试验中心
- 小升初语文专项训练
- 建筑工程质量检测资质分类与等级标准
- 周燕珉-我国养老社区的发展现状与规划
- 《生命里最后的读书会》读后感
- 实验室管理评审报告
- CCNA思科网院教程精华之网络基础知识




