Design Pattern Summary

Source: Internet
Author: User

Write in front

In software engineering, design patterns (Patterns) are a common, reusable solution.

During the life cycle of a real software development, we can look for one or several methods that can be used to solve software design problems in the DPS repository. Its fundamental purpose is to realize the object-oriented solid principle, so as to achieve the purpose of code reuse and increase maintainability.

design pattern is not a actually completed design, it can not be directly converted to the final code we need, can only be formalized description or templating how to solve the specific problem of the routine. the best way to master DP is for us to do it all by ourselves. Practice is the truth! In addition, the design pattern only describes the interaction between classes and objects, rather than the recipe for solving large-scale or monolithic software architecture problems.

Design patterns are a very powerful tool for software developers, but it's important to note that DP should not be considered a normative convention for software, but a means. It is very important that what we need to do is to understand the concepts of each pattern, especially the design ideas and ideas behind them, rather than just remembering their specific implementations, such as classes, methods, and properties.

Note: each software developer should know how and where to apply each specific pattern appropriately. Improper use or misuse not only results in low performance of the application, but also increases the complexity and maintainability of the code.

In general, software design patterns can be divided into three categories:

1. Creation mode (creational Design Patterns)

2. Structural mode (Structural design Patterns)

3. Behavioral mode (behavioral Design Patterns)

First, create the type (creational DP)

The Create pattern is a class of DP that handles the creation of objects, primarily for situations where a common form of object creation can lead to design problems or increase the complexity of the code.

The creation pattern is primarily a description of a moment. The main include the following 5 kinds:

1. Abstract Factory mode (factory)

2. Builder mode

3. Factory method Mode (Factory methods)

4. Prototype mode (PROTOTYPE)

5. Single case mode (Singleton)

Two, structural type (Structural DP)

The structure pattern is to simplify the design by using simple and practical methods to realize the relationship between different entities.

The structure model mainly describes a static structure. The main include the following 7 kinds:

1. Adapter mode (Adapter)

2. Bridging mode (bridge)

3. Combination mode (Composite)

4. Decoration Mode (Decorator)

5. Appearance mode (facade)

6. Enjoy meta-mode (Flyweight)

7, Agent mode (proxy)

Iii. Behavioral type (behavioral DP)

Behavioral patterns explain how different objects collaborate with each other. It describes how different objects and classes are sent from the message to achieve the goal, and how the task steps are divided between different objects.

The behavioral pattern mainly describes a process or process. The main include the following 11 kinds:

1. Responsibility chain mode (Chain of responsibility)

2. Command mode

3. Interpreter mode (interpreter)

4. Iterator mode (Iterator)

5. Mediation Mode (mediator)

6. Memo Mode (Memento)

7. Observer mode (OBSERVER)

8. Status mode (state)

9. Strategy Mode (strategy)

10. Template mode

11. Visitor Mode (Visitor)

End

The design pattern is fundamentally a set of ingenious martial arts moves, the root of which is to serve the object-oriented design and development.

Limited to the length of the article (I do not like to see too long article O (︶^︶) o), will also discuss some of the principles of OO, follow-up will be supplemented by the completion of 23 design patterns.

Design Pattern Summary

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.