본문 바로가기
ETC

SOLID Principle of OOP Design

by llHoYall 2021. 10. 24.

SOLID principle is a recommendation for good object-oriented design.

  • SRP (Single Responsibility Principle)
  • OCP (Open-Closed Principle)
  • LSP (Liskov Substitution Principle)
  • ISP (Interface Segregation Principle)
  • DIP (Dependency Inversion Principle)

For a good design, decrease coupling among modules and increase the cohesion of code.

SOLID principle helps it.

SRP (Single Responsibility Principle)

A class should have one and only one reason to change, meaning that a class should have only one job.

This principle helps to increase the reusability of a module.

OCP (Open-Closed Principle)

Objects or entities should be open for extension but closed for modification.

This principle helps to decrease the coupling among modules.

LSP (Liskov Substitution Principle)

Let q(x) be a property provable about objects of x of type T. Then q(y) should be provable for objects y of type S where S is a subtype of T.

ISP (Interface Segregation Principle)

A client should never be forced to implement an interface that it doesn't use, or clients shouldn't be forced to depend on methods they do not use.

This principle helps to decrease the coupling modules.

DIP (Dependency Inversion Principle)

Entities must depend on abstractions, not on concretions. It states that the high-level module must not depend on the low-level module, but they should depend on abstractions.

This principle helps to decrease the coupling modules.

'ETC' 카테고리의 다른 글

개발 관련 책 추천  (0) 2021.11.07
[티스토리] 소스코드 이쁘게 삽입하기 (Feat. highlight.js)  (0) 2020.08.27

댓글