Atitit. software development of several major rules, laws, and principles ... 1. Design Pattern Six Principles 21.1. Design pattern Six principles (1): Single Duty Principle 21.2. Design pattern six Principles (2): Richter Replacement Principle 21.3. Design pattern Six Principles (3): Dependency Inversion Principle 21.4. Design pattern Six principles (4): interface Isolation principle 21.5. Design pattern Six principles (5): Dimitri Law 21.6. Design pattern Six principles (6): Open and Close pri
Some basic features of OO
Package (encapsulation)
Inheritance (inheritance)
Polymorphic (polymorphism)
Poly (cohesion)
Coupling (COUPLING)
5 Principles for OO design (SOLID)
Single Duty principle (Srp-single Responsibility Principle)A CLASS should has only one REASON to change.
Open closure principle (ocp-open-closed Principle)You should is able to extend a classes behavior, without modifying it.
Richter
result of decades of software engineering experience. They are not the result of one person, but the crystallization of the ideas and writings of many software developers and researchers. Although they are described here as the principle of object-oriented design, they are in fact only a special case of the principles that have always existed in software engineering.These principles are as follows:1. Single Duty principle (the one Responsibility Principle,
some opinions on the Internet say that students are not suitable for learning the design model. As a student, there is no practical project experience in the enterprise and it is impossible to find out the change points and reuse points, therefore, it is easy to cause excessive design or the appropriate mode is not used in the design. However, design principles should be observed wherever they are.
For time reasons, we will only introduce the first one in the design principles: single responsi
, we can maximize code reuse, function reuse, and module reuse.
After talking about some basic design principles, let's take a look at Bob's five principles mentioned in Agile Software development design [1], namely, S.O.L. I. D.
The S.O.L. I. D Principle integrates the basic principles and proposes more feasible methods.
SRP (Single Responsibility Principle)
Single Responsibility Principle: For a class, there should be only one reason for its change.
Notes on the single responsibility principle of "You must know. Net" by Wang Tao
I. Concepts
Single Responsibility Principle (SRP, single responsibility principle): A class, it is best to do only one thing, there is only one reason for its change.
SRP can be seen as an extension of low coupling and high cohesion in Object-Oriented principles. It defines responsibility as the cause of change to improve cohe
1. Single Responsibility Principle (SRP)
The single responsibility principle (SRP) should have only one reason for its change in a class. That is to say, do not put different responsibilities for different reasons of change together, because different changes will affect irrelevant responsibilities. In other words, you don't need to worry about things you shouldn't care about. You can manage your own things
classes into a jar to reuse all DaO classes in other projects based on the same database, this Dao component should not contain any control layer (servlet) or presentation layer (JSP, etc.) related classes, because these classes cannot be reused at the same time.
In addition, when implementing rep, similar to the SRP In the object-oriented design principle (single responsibility principle), a component should not contain too many classes of different
1) The single responsiblity principle (SRP)
2) The Open-Close principle (OCP) Principle)
3) The liskov substitution principle (LSP)
4) Dependency inversion principle (DIP)
5) the interface segregation principle (ISP)
I. Single Responsibility Principle (SRP)
For a class, there should be only one reason for its change. What software design really needs to do is to discover responsibilities and separate
the system.The object-oriented design principle and design pattern are also the compass to reconstruct the system rationally, and the reconstruction (refactoring) is to improve the quality and performance of the software by adjusting the program code without changing the existing functions of the software, and make the design pattern and structure of the program more reasonable, and improve the expansibility and maintainability of the software.
Introduction to Object-oriented design pr
) rebuild should be carried out in a small step; (3) the more technical debt accumulation, the more difficult the rebuild will be.
9,Basic principles for Structure Optimization: After the functional logic is completed, in addition to code refactoring, You need to review the software structure in many cases to reconstruct the structure. Good structure design should follow some principles, and the Principles themselves are a summary of experience. Based on these principles, we can have a good desi
Single Responsibility Principle (SRP.
Definition:
There shoshould never be more than one reason for a class to change.
There should be only one reason for the change.
Sometimes, developers may have some problems when designing interfaces. For example, user attributes and user behaviors are declared in an interface. This causes the Business Objects and business logic to be put together. As a result, this interface has two responsibilities and the inter
The core idea of OOP:
Encapsulation (encapsulation ).
Inheritance (inheritance ).
Polymorphism (polymorphism ).
What is a class?
Concept layer: Abstraction of some responsibilities.
Specification layer: A series of interfaces that can be used by other objects.
Language layer: encapsulates code and data.
Software Design Principles:
Programming for the interface, rather than for the implementation.
Do not abuse inheritance and clarify the relationship between inheritance and combination.
[Inhe
responsibility Principle (SRP): Avoid having the same responsibilities spread across different classes and avoid having too many responsibilities for one class."Why adhere to the SRP" 1) can reduce the coupling between classes 2) improve the reusability of classes2. Interface isolation principle (ISP): Clients are not forced to implement some interfaces that are not available, that is, the use of multiple
/closing the design principles. By the way, the letter "O" in solid refers to the principle of open/close design.Single principle of responsibilitySingle Responsibility Principle (SRP)The single principle of responsibility is another solid design principle, and the letter "S" in solid refers to it. According to the SRP, the reason for a class modification should be one or the other, or a class should always
Clientkeyexchange message which also contains a newly-generated DH p Ublic key. The DH yields the "Pre-master secret".
Dhe_dss : like Dhe_rsa , but the server have a DSS key ("DSS" is also known as "DSA") . DSS is a signature-only algorithm.
Less commonly used key exchange algorithms include:
DH: The server ' s key is of type Diffie-hellman (we are talking of a certificate which contains a DH key). This used to is "popular" in an administrative (US federal government mandate
preliminary1. S.O.L.I.D principleObject-oriented three elements are "encapsulation, inheritance, polymorphism", and any object-oriented programming language will support these three elements syntactically. It is very difficult to use the three elements, especially polymorphism, with the help of abstract thinking, and the S.O.L.I.D design principle is a good guide:
SRP (Single Responsibility Principle, sole responsibility principle)
OCP (
compilation does not pass (no product code)
Write the Product Code
Test Pass
Refactor the code and ensure the test passes (refactoring the next lab session)
Cycle through the development of all functions
(1)JUnit appears red bar, test failed(2) After the change appears green bar, test passTDD coded Rhythm:1. add test code,JUnit appears red bar2. Modify the Product code3.JUnit appears green bar, task completed(3) self-test(ii) Object-oriented three elements1. Abstraction2. E
class, controlling the user's modification of the class and the degree of access to the data, resulting in the benefits of modularity (modularity) and information hiding (information hiding) ; interface (interface) is an accurate description of the package.Based on encapsulation, inheritance can implement code reuse , it should be noted that inheritance is more important to achieve polymorphism. polymorphism refers to the phenomenon that different class objects will execute different code whe
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.