,apatternisaninstruction,whichshowshowthisspatialconfigurationcanbeused,overandoveragaintoresolvethegivensystemofforces,whereverthecontextmakesitrelevant. Thepatternis,inshort,atthesametimeathing,whichhappensintheworld,andtherulewhichtellsushowtocreatethatthing,’sbothaprocessandathing,bothadescriptionofathingwhichisalive,(patternname)问题(problem)描述应该在何时使用模式解决方案(solution)设计的组成成分它们之间的相互关系及各自的职责和协作方式效果(consequences):Model/View/ControllerMVC模型Model:应用对象视图View:屏幕上的表示控制器Controller:用户界面对用户输入的相应通过“订购/通知”posite模式适用问题将一些对象划为一组,并将该组对象当作一个对象来使用涉及的模式Strategy模式View-Controller关系是Strategy模式的一个例子View使用Controller子类对象实现特定的响应策略通过改变View的Controller来改变View对用户输入的响应Strategy模式适用问题需要静态或动态地替换一个算法有很多不同的算法算法中包含需要封装的复杂的数据结构涉及的模式其他FactoryMethod用于指定View的缺省控制器Decorator用于增加视图滚动
设计模式培训教材 来自beplayapp体育下载www.apt-nc.com转载请标明出处.