[Clean Code] SOLID 원칙

Junsoo Choi·2021년 7월 6일
0

S: The Single Responsibility Principle

Gather together the thigns that change for the same reasons. Separate things that change for different reasons

O: The Open-Closed Principle

A module should be open for extension but closed for modification

disk file에 쓰는 것과, printer, screen, pipe에 쓰는 방법이 모두 다르다면 if문이 넘쳐나고 개발이 힘들 것이다. requirement가 변하는 경우, 기존의 코드의 '일부'만 틀리게 되는 것이다. 틀린 '일부'를 위해 맞는 '대부분'의 코드를 수정하지 말자.

L: The Liskov Substitution Principle

A program that uses an interface must not be confused by implementation of that interface

인터페이스는 어떠한 base를 abstraction하고 있는데, 인터페이스의 implementation 때문에 헷갈려서는 안된다. This principle is about keeping abstractions crisp and well-defined.

I: The Interface Segregation Principle

Keep interfaces small so that users don't end up depending on things they don't need

D: The dependency Inversion Principle

Depend in the direction of abstraction. High level modules should not depend upon low level details

원문: http://blog.cleancoder.com/uncle-bob/2020/10/18/Solid-Relevance.html

profile
Youtube: 개발자준

0개의 댓글

관련 채용 정보