📘 클린 아키텍처 북스터디 정리입니다
📚 도서: 로버트 C. 마틴 《Clean Architecture》
🧑💻 목적: 올바른 설계에 대한 감각과 습관을 익히기 위해
🗓️ 진행 기간: 2025년 7월 ~ 매주 2장
불필요한 짐을 실은 무언가에 의존하면 예상치도 못한 문제에 빠진다는 사실이다
public interface MultiFunctionDevice {
void print(Document d);
void scan(Document d);
void fax(Document d);
}
public class OldPrinter implements MultiFunctionDevice { // OldPrinter는 프린트만 가능한 장비
public void print(Document d) {
System.out.println("프린트 중입니다");
}
public void scan(Document d) { // 사용하지않는 메서드이지만 인터페이스에 구현을 강제당함
throw new UnsupportedOperationException("스캔이 지원되지 않습니다");
}
public void fax(Document d) { // 사용하지않는 메서드이지만 인터페이스에 구현을 강제당함
throw new UnsupportedOperationException("팩스가 지원되지 않습니다");
}
}
public interface Printer {
void print(Document d);
}
public interface Scanner {
void scan(Document d);
}
public interface Fax {
void fax(Document d);
}
public class OldPrinter implements Printer { // OldPrinter는 필요한 기능만 구현
public void print(Document d) {
System.out.println("Printing only...");
}
}
public class ModernPrinter implements Printer, Scanner, Fax {
public void print(Document d) { /* ... */ }
public void scan(Document d) { /* ... */ }
public void fax(Document d) { /* ... */ }
}
import, use, include와 같은 타입 선언문을 사용 강제 → 컴파일 타임에 타입 의존성 발생