This article just wants to briefly discuss the relationship between the design pattern and the object-oriented design pattern to help you understand the design pattern.
First, let's understand two definitions:
1. The design pattern describes a general solution to a certain type of common problems in the software design process.
2. The object-oriented design mode describes the common organizational relationships between classes and communication objects in specific scenarios during the object-oriented design process.
From the definition, we can see that the design pattern is for the software design process, and the premise of the object-oriented design pattern is to use the software designed for the object.
Therefore, although the design pattern we usually call implies "object-oriented design pattern ".
But this does not mean that the "Design Model" is equal to the "oriented
Object design pattern ", not to mention gof.
That is to say, apart from
There are other design patterns. In addition to the 23 gof design patterns, there are more object-oriented
Design mode.
Design Pattern and object-oriented
•
The object-oriented design model solves the problem of "the Organizational Relationship between classes and objects that communicate with each other,
Including their roles, responsibilities, and collaboration methods.
•
The object-oriented design pattern is "Good object-oriented design". The so-called "Good object-oriented design" is something that can meet the needs of "Coping with changes, improving
"Use" Design
. That is, it can better meet people's needs for software design.
•
Object-Oriented Design Patterns Describe software design, so they are independent of programming languages, so they are not limited to a certain language. However
The final implementation of the computing mode still needs to use the object-oriented programming language for table
Is based on the C # language, but actually it applies to support. net boxes.
Racks
There are. NET languages, such as Visual Basic. NET and C ++/CLI.
•
The object-oriented design model is based on an empirical understanding of "Object-Oriented", rather than simply copying images.
To make good use of the object-oriented design model, you must first master "Object-Oriented "!
In particular, understanding of the three object-oriented mechanisms:
-
Encapsulate and hide internal implementations
-
Inheritance, reuse existing code
-
Polymorphism, modifying object behavior
However, when we understand the object-oriented design model, we should not understand it based on a certain language, nor use these three mechanisms to do a good job.
Object-Oriented Design. Not an object-oriented language (such as C #),
It achieves object-oriented design and development! This requires us to stand in the face
The object can understand these three mechanisms and various models from a macro perspective. Therefore, any serious object-oriented Programmer (such as C # programmer) needs
To learn systematically
Learn the object-oriented knowledge, and acquire the object-oriented knowledge from the programming language, which is not competent for the object-oriented design and development.
Any of our design patterns are built on the design principles, that is, the six principles of the design patterns.
Object-oriented design is also the three basic principles
-
Interface Programming, rather than implementation programming
-
Object combination is preferred, rather than class inheritance
-
Encapsulation changes
Ke fuchuan
Scalable 1 program
Good Flexibility
111 ,.,,
Yiyuan
Lida
Item 6
Category
.
Structure +
1. Create +
Behavior +
, Basic pair
Bytes
,
Production
I
,
Object-oriented
Single responsibility
Open and closed
Yi reversed
"Burrys replacement
Synthesis, aggregation, Reuse
Dumit
Image
Smoke one
Polymorphism "src =" file: // C:/users/wyj/appdata/local/temp/msohtmlclip1/01/clip_image001.png "width =" 576 "Height =" 281 ">
1.
Creator: it is related to object creation.
2.
Structural: A combination of processing classes or objects.
3.
Behavioral: describes how classes or objects interact and how to assign responsibilities.