
[Java] 객체 지향 프로그래밍의 5가지 기본 원칙 SOLID 를 예제와 함께 알아 보자. (2)
·
Programming Language/Java
인터페이스 분리 원칙 (Interface segregation principle, ISP)클라이언트별로 세분화된 인터페이스를 만들어야한다. 인터페이스를 분리한다는 점에서 앞서 1편에서 살펴보았던 단일책임원칙과 동일하다.그러나 분리하는 관점 자체가 다르다. 인터페이스 분리 원칙이 깨진 상황public interface Repository { void createUser(); User findUserById(Long id); void createArticle(); Article findArticleById(Long id);}public class UserRepository implements Repository { @Override public void createUse..