java设计模式 (java design pattern)

1. Singleton mode
Ensure that a class has only one instance, instantiates itself and provides this instance to the whole system.
2. Factory method
Define an interface for creating objects and let subclasses decide which class to instantiate. Factory methods delay instantiation of a class to its subclasses.
3. Abstract factory pattern
Provide an interface for creating a set of related or interdependent objects without specifying their specific classes.
4. Template method pattern
Define the framework of an algorithm in operation, and delay some steps to subclasses. The subclass can redefine some specific steps of the algorithm without changing the structure of the algorithm.
5. Builder mode
Separate the construction of a complex object from its representation, so that the same construction process can create different representations.
6. Agent mode
Provide a proxy for other objects to control access to this object.
7. Prototype mode
Use prototype instances to specify the types of objects to create, and create new objects by copying these prototypes.
8. Intermediary model
A mediator object is used to encapsulate a series of object interactions. The mediator makes each object interact without display, so that its coupling is loose, and the interaction between them can be changed independently.
9. Command mode
Encapsulating a request into an object allows you to parameterize the client with different requests, queue requests or record request logs, which can provide command revocation and recovery functions.
10. Responsibility chain model
Multiple objects have the opportunity to process the request, thus avoiding the coupling relationship between the sender and receiver of the request. Connect these objects into a chain and pass the request along the chain until an object processes it.
11. Decoration mode
Dynamically add some additional responsibilities to some objects. In terms of adding functions, decoration pattern is more flexible than generating subclasses.
12. Strategy mode
Define a set of algorithms, encapsulate each algorithm, and make them interchangeable.
13. Adapter mode
Replace the interface of a class with another interface expected by the client, so that the two classes that could not work together due to interface mismatch can work together.
14. Iterator mode
It provides a way to access each element in a container object without exposing the internal details of the object.
15. Combination mode
The objects are combined into a tree structure to represent the "part whole" hierarchy, so that users have consistency in the use of single objects and combined objects.
16. Observer mode
Defining objects is a one to many dependency, so that whenever an object changes state, all objects that depend on it will be notified and updated automatically.
17. Facade mode
It is required that the external and internal communication of a subsystem must be carried out through a unified object. Facade mode provides a high-level interface, which makes the subsystem easier to use.
18. Memo mode
Without breaking the encapsulation, capture the internal state of an object and save the state outside the object. This will restore the object to its original saved state later.
19. Visitor mode
Encapsulates some operations that act on each element in a data structure. It can define new operations that act on these elements without changing the data structure.
20. State mode
When an object's internal state changes, it is allowed to change its behavior, and the object looks like it has changed its class.
21. Interpreter mode
Given a language, define a representation of its grammar and define an interpreter that uses the representation to interpret sentences in the language.
22. Enjoy yuan mode
Using shared objects can effectively support a large number of fine-grained objects.
23. Bridge mode
Decouple abstraction from implementation so that both can change independently.
 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值