模式分類

路過的世界發表於2017-05-22

1. 建立型:Creational

Creational patterns involve object instantiation and all provide a way to decouple a client from the objects it needs to instantiate.

建立型模式,涉及到物件的例項化。這個模式提供一個方法,讓客戶(Client)從所需要例項化的物件中解耦

singleton,builder,prototype,abstract factory,factory method

2. 行為型Behavioral

Any pattern that is a Behavioral Pattern is concerned with how classes and objects interact and distribute responsibility.

類和物件如何互動,以及職責分配

Template method command ,iterator,visitor ,mediator,memento,interpreter,observer,chain of responsibility,state,strategy.

3. 結構型

Structural patterns let you compose classes or objects into larger structures.

組合類和物件,到更大的機構

 

decorator,proxy, facade,comosite,adptor,bridgy.

 

 

還有一種分類方式:

Patterns are often classified by a second attribute: whether or not
the pattern deals with classes or objects:

根據處理類還是物件分

 

 

相關文章