HomeAboutMeBlogGuest
© 2025 Sejin Cha. All rights reserved.
Built with Next.js, deployed on Vercel
📝
남득윤 학습 저장소
/
객체 지향 프로그래밍
객체 지향 프로그래밍
/
The Principles of OOD - 로버트 마틴
The Principles of OOD - 로버트 마틴
The Principles of OOD - 로버트 마틴

The Principles of OOD - 로버트 마틴

The Principles of OOD- 로버트 마틴

The first five principles are principles of class design. They are :
SRP
The Single Responsiblity Principle
“A class should have one, and only, one reason to change.“
OCP
The Open Closed Principle
You shloud be able to extend a classes behavior, without modifying it.
LSP
The Liskov Substitution Principle
Derived classes must be substitutable for their base classes.
ISP
The Interface Segeregation Principle
Make fine grained interfaces that are client specific.
DIP
The Dependency Inversion Principle
Depend on abstraction, not on concretions.
추가 설명
  • OCP - Software entities (classes, modules, etc) should be open for extension, but closed for modification.
  • LSP - Derived classes must usable through the base class interface without the need for the user to know the difference
  • DIP
    • A. High-level modules should not depend on low-level modules. Both should depend on abstractions.
      B. Abstractions should not depend on details. Details should depend on abstractions.
 

The next six principles are about packages.
The first three package principles are about package cohesion, they tell us what to put inside packages:
REP
The Release Reuse Equivalency Principle
The granule of reuse is the granule of release.
CCP
The Common Closure Principle
classes that change together are packaged together.
CRP
The Common Reuse Principle
classes that are used together are packaged toghether.
추가 설명
  • REP - The granule of reuse is the same as the granule of release. Only components that are released through a tracking system can be effectively reused.
  • CCP - Classes within a released component should share common closure. That is, if one needs to be changed, they all are likely to need to be changed. What affects one, affects all.
  • CRP - Classes within a released componen should be reused together. That is, it is impossible to separate the components from each other in order to reuse less than the total.
 
 
 
The last three principles are about the couplings between packages, and talk about metrics that evaluate the structure of a system.
ADP
The Acyclic Dependencies Principle
The dependency graph of package must have no cycles..
SDP
The Stable Dependencies Principle
Depend in the direction of stability
SAP
The Stable Abstractions Principle
Abstractness increases with stability
추가 설명
  • ADP - The dependency structure for released components must be a DAG.There can be no cycles.
  • SDP - Dependencies between released components must run in the direction of stability. The dependee must be more stable than the depender.
  • SAP - The more stable a released component is, the more it mustconsist of abstract classes. A completely stable componentshould consist of nothing but abstract classes.