Web
-
스프링MVC -관심사의 분리Web/Spring 2023. 3. 4. 12:53
스프링MVC패턴이란? 스프링 MVC패턴은 Model-View-Controller로 각각의 역할을 분담하여 요청을 처리하는 것을 의미한다. Model은 데이터, View는 화면, Controller는 model과 view사이 처리를 담당하여 클라이언트 요청을 처리하게된다. 그렇다면 어떤 기준으로 MVC패턴을 만드는 것 일까? 먼저 간단한 코드를 통해 관심사에 따라 전체 코드를 분리해서 생각해보도록 하자. 여기서 관심사는 각 코드 혹은 메서드등이 처리해야할 일이다. 크게 입력, 처리, 출력 나누어 생각해 볼 수 있다. *관심사의 분리는 객체지향 설계 SOLID원칙의 S(SRP)에 따라 담당하는 기능을 기준으로 클래스(객체)를 분리하여 프로그램의 유지보수성을 높이기 위한 기법에서 나온 것이다. 단일책임원칙에 ..