Learn about solid principles of object oriented design, we have the largest and most updated solid principles of object oriented design information on alibabacloud.com
Object-oriented design principles are at the heart of oops programming, but most of the Java programmers I've seen are enthusiastic about design patterns like Singleton (singleton), Decorator (adorner), OBSERVER (Observer), Instead of focusing enough attention on learning
In the previous Java 23, you learned about the singleton mode and Factory mode of design mode. Here, the design pattern is introducedPrinciple of object-oriented thought designIn the actual development, we want to understand the object-o
Original Author: Robert C. Martin
Original article: http://www.objectmentor.com/resources/articles/Principles_and_Patterns.pdf
Reference page: http://www.objectmentor.com/resources/publishedArticles.html
Ii. Object-oriented Design Principles
1 The Open-Close principle (open and closed principle)
A module s
Object-oriented design principle principle objective object-oriented design original table single Responsibility principle case Closed-closing principle case dependence reversal principle caseObject-
The merging Reuse Principle is also known as the composition/aggregate Reuse Principle and carp principle. Its definition is as follows:
Composite Reuse Principle (CRP): Use object combinations as much as possible instead of inheritance to achieve reuse.
The merging Reuse Principle is to use some existing objects in a new object through the association relationship (including the combination
/20071205214949530.html of interface segregation principle (ISP)-OO design, we introduce a class-oriented design principle:
Clients shocould not be forced to depend upon interfaces that they do not use. users cannot be forced to rely on interfaces they do not use.
Applying this concept to a wider range of packages is the basic concept of CRP: do not combine cla
that the structure of the program is starting to become loose. Any change to the input or output device will force you to re-organize the condition judgment of the while loop. But after all, your program can work normally. But now you have reached the bottom line. If a hateful customer breaks your design by changing the demand, you will leave immediately. You made up your mind.
Your crash ......
Unfortunately, it didn't take two weeks. You did
can manipulate an abstract body, in which the module relies on a fixed abstract body, so it can be closed for modification, and through this abstract derivation, it can also extend the behavior of this module.Developers should abstract only those parts of the program that exhibit frequent changes, rejecting immature abstractions and abstractions as important as themselves.The Richter replacement principle:Its subclass object can be substituted for th
30-minute understanding of Object-Oriented Design Principles
Many people have read the design patterns, but Martin does not have much estimation on the object-oriented
Today, I attended the course "C # object-oriented design patterns (1): Object-oriented Design Patterns and Principles. Summarized some notes.First, we will introduce what is the
1. Opening and closing principle (the Open Closed principle OCP)
A module should be open in terms of extensibility and should be closed in terms of modification. Therefore, the interface encapsulation mechanism, abstract mechanism and polymorphic technique should be considered as far as possible in object-oriented design. The principle is also suitable for non
The object-oriented design principle is the core of OOPS (object-oriented programming system, Object-Oriented Programming System) programming. However, most Java programmers pursue
The object-oriented design principle is the core of OOPS (object-oriented programming system) programming.Design patterns such as Singleton, decorator, and observer do not focus on Object-Orie
Labels: OCP Java design mode Object-Oriented Design1. Single Responsibility Principle
The core idea of a single responsibility principle is: every object in the system should have only one independent responsibility, and all objects are concerned with the completion of their own responsibilities. SRP single Responsibil
. Dependency inversion principle: high-level modules do not depend on low-layer modules, both of which are dependent on abstraction. Or just the example: Duck is a high-rise module, Fly is a low-level module. Duck does not depend on fly, the high-rise module changes slowly, while the lower-level modules change slowly.Abstractions should not be dependent on implementation details, and implementation details should be dependent on abstraction. Fly is an abstraction, it does not depend on how to fl
Labels: Object-oriented Design Principles
After the previous in-depth explanation, we have basically made it clear about the solid principle. However, if you want to skillfully apply the solid principle, it is not enough to know w
The object-oriented design principle is the core of OOPS (object-oriented programming system, Object-Oriented Programming System) programming. However, most Java programmers pursue
attribute Name: type [= default value]
Visibility method Name (parameter list) [: Return value type]
Examples are as follows: (3) The relationship between classes ① Association Relationship 1) bidirectional correlation. Examples are as follows: 2) One-way association. Examples are as follows: 3) Self-correlating. Examples are as follows: 4) Multiple sexual associations. Examples are as follows: 5) Aggregation relationship. Examples are as follows: 6) combined relationship. Simi
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.