- 2
- 0
- 约1.02万字
- 约 32页
- 2016-11-27 发布于河南
- 举报
design patterns
Observer Example: MVC Subject Register(Observer) Unregister(Observer) NotifyAll() Observer virtual OnUpdate() for all o in observers { o.OnUpdate() } Controller View virtual OnUpdate() Chain of Responsibility Handler handleRequest() ConcreteHandler2 handleRequest() Client ContextInterface() ConcreteHandler1 handleRequest() Decouple sender of a request from receiver Give more than one object a chance to handle Flexibility in assigning responsibility Often applied with Composite successor Chain of Responsibility Example: handling events in a graphical hierarchy Figure handleEvent(Event) CompositeFigure Interactor children 0..* If interactor != null interactor.handle(event,this) else parent.handleEvent(event) 0..1 parent handle(Event,Figure) 0..* Concluding Design Patterns (GoF) provide a foundation for further understanding of: Object-Oriented design Software Architecture Understanding patterns can take some time Re-reading them over time helps As does applying them in your own designs Q A * Design Patterns Purpose A design pattern captures design expertise –patterns are not created from thin air, but abstracted from existing design examples Using design patterns is reuse of design expertise Studying design patterns is a way of studying how the “experts” do design Design patterns provide a vocabulary for talking about design Why design patterns in SA? If you’re a software engineer, you should know about them anyway There are many architectural patterns published, and the GoF Design Patterns is a prerequisite to understanding these: Mowbray and Malveau – CORBA Design Patterns Schmidt et al – Pattern-Oriented Software Architecture Design Patterns help you break out of first-generation OO thought patterns Patterns vs “Design” Patterns are design But: patterns transcend the “identify classes and associations” approach to design Instead: learn to recognize patterns in the problem space and translate to the solution Patterns can capture OO design principles with
您可能关注的文档
最近下载
- 图案变化与统一课件设计.pptx VIP
- 2025年金融风险管理师买入看跌期权与卖出看跌期权策略专题试卷及解析.pdf VIP
- 2025年拍卖师拍卖谈判中的谈判记录与总结技巧专题试卷及解析.pdf VIP
- 2025年房地产经纪人客户隐私保护监管政策解读专题试卷及解析.pdf VIP
- 基于单片机的数控直流稳压电源的设计.docx VIP
- 县域消费扶贫与长效帮扶机制分析.pdf VIP
- 2025年项目管理专业项目交付成果验收检查表编制专题试卷及解析.pdf VIP
- 煤矿露天改扩建项目竣工验收报告.docx
- 人体解剖学复习测试有答案(二).doc VIP
- 基于stm32的智能小车设计毕业设计论文.docx VIP
原创力文档

文档评论(0)