Design Pattern.pptVIP

  • 10
  • 0
  • 约5.06千字
  • 约 19页
  • 2017-07-03 发布于湖北
  • 举报
DesignPattern概要1

Design Pattern-- Factory Model Contents 1.1 What is software design pattern A pattern is a solution to a problem in a context. In software engineering, a design pattern is a general reusable solution to a commonly occurring problem within a given context in software design. 1.2 The development of design pattern Patterns originated as an architectural concept by Christopher Alexander. In 1987, Kent Beck and Ward Cunningham began experimenting with the idea of applying patterns to programming and presented their results at the OOPSLA conference that year. 1.3 The classification of design pattern GoF list 23 common design patterns and grouped into the three categories: creational patterns, structural patterns, and behavioral patterns. 1.4 Factory Model Factory model includes three design patterns: Simple Factory Factory Method Abstract Factory The relationship between them is showed in the graph. The details for the three patterns will be introduced in the followed parts. 2.1 The motivation of Simple Factory The factory create what you want, you just need to tell the name. 2.2 The structure of Simple Factory 2.3 The example of Simple Factory 2.4 the application and advantage Simple factory is applied in may places and it is widely used, but it is a good application when the subclass is limited, and the client don’t need to know the detail about how to create the production. Simple Factory Pattern provides a number of advantages. It provides an elegant way to abstract your code so there’s less visual clutter It allows you to introduce specialized, focused classes with a single purpose It makes the code more maintainable as there’s a single place where classes are instantiated, and each class serves a single purpose 3.1 The motivation of Factory Method In Simple Factory pattern, you have to modify you factory code when a new production added 3.2 The structure of Factory Method The participants classes in this pattern are: IProduct defines the interface for obje

文档评论(0)

1亿VIP精品文档

相关文档