Logical Architecture using Layers
Logical Architecture using Layers
Software Architecture는 쉽게 마해 큰 밑그림이다. 뼈대+구조라고 할 수 있다. 즉, 전체 시스템의 구조를 생각하여 균형과 조화를 이루도록 구성하는 것이다. Logical Architecture는 논리적 구조이다. 예를 들어, class들을 묶어서 package로, 그리고 package를 subsystem으로 구성한다. 이는 물리적인 element에 배치시키는 것이 아니기 때문에 logical이라고 할 수 있다. 즉, 물리적 배치는 신경쓰지 않는 논리적 묶음이다.
Layer는 Presentation Layer(UI Layer), Application Logic Layer(or Domain Layer), Technical Service Layer로 나눌 수 있다. Layer Architecture의 중요한 개념 중 하나는 responsibility의 문제이다. 책임을 분산시키지말고, 해당된 object에만 주는 cohesive가 중요하다.
우리는 app에서 외부 헤더 파일, 즉 stdio.h 처럼 헤더 파일을 통해 scanf나 printf를 사용한다. 이러한 헤더파일은 자주 바뀌지 않고, application에 independent하며 reusable하다. 이 예시에서의 app이 Application Logic Layer, stidio.h와 같은 헤더 파일이 Technical Service Layer라고 할 수 있다.
명사를 추출해서 class를 만들고, 각 class 마다의 goal이 존재한다. 각 class마다 goal에 대한 responsibility가 있으며, 철저히 자기에 할당된 책임에만 관심을 두는 것이 design with layer의 가이드라인이다. ( cohesive responsibilities, with a clean separation of concerns(SOC) ).
Model-View Separation Principle
MVC Model은 model, view, controller 로 구성된다. GUI를 사용한 어플리케이션에 대해 디자인된 패턴이다. model은 domain layer로 생각할 수 있고 view는 UI layer, controller는 application layer이다. 그래서 work flow는 View에서 Controller, 그리고 Model이라고 볼 수 있다.