Mode Design Mode
Mode: each mode describes a problem that occurs repeatedly around us and the core of the solution.
Design Mode: The design mode describes the general solutions for a certain type of common problems in the software design process.
What is an object:
In terms of concept, an object is an abstraction with certain responsibilities,
In terms of specifications, an object is a series of public interfaces that can be used by other objects.
In terms of language implementation, objects are encapsulatedCodeAnd data.
Design principles
1. Programming for interfaces, rather than implementing programming.
2. Object combination is preferred, rather than class inheritance.
3. encapsulation changes.
4. Use the refactoring Mode
More specific principles:
Single Responsibility Principle: A class should have only one reason for its change.
Open and closed principle: class modules should be extended, but cannot be modified.
Replacement Principle: The subclass must be able to replace its base class.
Dependency inversion principle: High-level modules should not depend on underlying modules, both of which should depend on abstraction. abstraction should not depend on implementation details, and implementation details must depend on abstraction.
Interface isolation principle: Customers should not be forcedProgramDependent on methods they do not need.