Kim Jinung

Front controller 그리고 Adapter pattern 본문

Computer Science/Design Pattern

Front controller 그리고 Adapter pattern

Kim Jinung 2023. 3. 20. 21:34

https://en.wikipedia.org/wiki/Front_controller

 

Front controller - Wikipedia

From Wikipedia, the free encyclopedia The front controller software design pattern is listed in several pattern catalogs and is related to the design of web applications. It is "a controller that handles all requests for a website,"[1] which is a useful st

en.wikipedia.org

Front controller

비지니스 요구사항에 따라서 다양한 컨트롤러를 필요로하게 된다. 각각 컨트롤러가 요구하는 파라미터가 달라서 아키텍처의 복잡도가 증가하게 되는데 이때 이러한 컨트롤러들의 컨트롤러인 프론트 컨트롤러를 앞에 하나 더 두는 패턴을 사용할 수 있다. 그 구체적인 예시가 바로 어댑터 패턴이다.

 

 

https://en.wikipedia.org/wiki/Adapter_pattern

 

Adapter pattern - Wikipedia

From Wikipedia, the free encyclopedia Design pattern in computer programming In software engineering, the adapter pattern is a software design pattern (also known as wrapper, an alternative naming shared with the decorator pattern) that allows the interfac

en.wikipedia.org

Adapter pattern

어댑터 패턴은 요청이 들어왔을 때 해당 요청에 해당하는 핸들러(컨트롤러)를 매핑해서 가져온다. 그리고 이를 처리할 수 있는 핸들러 어댑터를 찾는다. (스프링 프레임워크의 경우 루프 태워서 인스턴스인지 확인한 뒤 캐스팅한다.) 그리고 이 어댑터가 컨트롤러의 비지니스 로직을 직접 실행 시키고 그 결과를 프론트 컨트롤러의 요구사항에 맞춰서 결과를 변환하여 반환한다. 말 그대로 어댑터 역할을 한다. 

'Computer Science > Design Pattern' 카테고리의 다른 글

Proxy pattern, Decorator pattern  (0) 2023.06.05
Callback pattern & Template callback pattern  (0) 2023.06.05
Strategy pattern(Policy pattern)  (0) 2023.06.05
Template method pattern  (0) 2023.06.05
Inheritance, Composition  (0) 2023.05.15