OOP设计原则
Software Architecture & Engineering · 8 notes
- Open–Closed Principlehistorical
What the open–closed principle is, why it is needed, and how to implement it through abstractions, inheritance, composition, and aggregation.
- Liskov Substitution Principlehistorical
What the Liskov substitution principle is, why it is needed, and how subclasses should preserve the meaning of parent-class behavior.
- Dependency Inversion Principlehistorical
What the dependency inversion principle is, why it is needed, and implementation guidance centered on interfaces and abstract classes.
- Single Responsibility Principlehistorical
What the single responsibility principle is, why it is needed, and how to separate different responsibilities into different classes or modules.
- Interface Segregation Principlehistorical
What the interface segregation principle is, why it is needed, and how to keep interfaces small and tailored to their callers.
- Law of Demeterhistorical
What the Law of Demeter is, why it is needed, and how to reduce coupling by limiting what objects depend on and expose.
- Composition Reuse Principlehistorical
What the composition reuse principle is, why it is needed, and how composition or aggregation can be preferred over inheritance for code reuse.
- Object-Oriented Design Principleshistorical
What object-oriented design principles are, why they are needed, and the main principles covered by these notes.