Model View Controller pattern
모델-뷰-컨트롤러(Model–View–Controller, MVC)는 소프트웨어 공학에서 사용되는 아키텍처 패턴이다. 이 패턴을 성공적으로 사용하면, 사용자 인터페이스로부터 비즈니스 로직을 분리하여 애플리케이션의 시각적 요소나 그 이면에서 실행되는 비즈니스 로직을 서로 영향 없이 쉽게 고칠 수 있는 애플리케이션을 만들 수 있다. MVC에서 모델은 애플리케이션의 정보(데이터)를 나타내며, 뷰는 텍스트, 체크박스 항목 등과 같은 사용자 인터페이스 요소를 나타내고, 컨트롤러는 데이터와 비즈니스 로직 사이의 상호동작을 관리한다.
ModelViewControllerDiagram2.gif
Category
Model
The model represents data and the rules that govern access to and updates of this data. In enterprise software, a model often serves as a software approximation of a real-world process.
데이터구조를 표현한다. 일반적으로 모델 클래스는 데이터를 추출, 입력, 갱신하는등의 함수를 포함하게 된다.
View
The view renders the contents of a model. It specifies exactly how the model data should be presented. If the model data changes, the view must update its presentation as needed. This can be achieved by using a push model, in which the view registers itself with the model for change notifications, or a pull model, in which the view is responsible for calling the model when it needs to retrieve the most current data.
사용자에게 보여질 부분을 표현한다.
Controller
The controller translates the user's interactions with the view into actions that the model will perform. In a stand-alone GUI client, user interactions could be button clicks or menu selections, whereas in an enterprise web application, they appear as GET and POST HTTP requests. Depending on the context, a controller may also select a new view — for example, a web page of results — to present back to the user.
일반적으로 모델과 뷰(혹은 HTTP 요청을 처리하여 웹페이지를 생성하는 어떤 것)사이에서 동작한다다.
History
MVC는 제록스 팰러앨토 연구소에서 스몰토크 관련 일을 하던 Trygve Reenskaug이 1979년 최초로 소개했다. 관련 구현은 영향력있는 논문인 《스몰토크-80에서의 애플리케이션 프로그래밍: 모델-뷰-컨트롤러를 사용하는 방법》에서 깊이 있게 설명되었다.
MVC는 여러 파생 패턴을 가지고 있다; 그 중 (마이크로소프트가 사용했기 때문에) 가장 널리 알려진 것은 1990년대 초기부터 등장하기 시작한 모델 뷰 프리젠터 패턴이다. 이 패턴은 MVC의 진화된 모습을 목표로 설계되었다. 그러나 모델-뷰-컨트롤러는 여전히 매우 널리 사용되고 있다.
2002년 11월 W3C는 미래의 웹 애플리케이션에 사용될 X폼즈(XForms) 아키텍처에 MVC 구조가 포함되도록 투표하여 가결하였다. 이 규격은 XHTML 2.0 규격에 바로 통합될 것이다. 현재 20개가 넘는 업체가 애플리케이션 스텍에 MVC가 통합된 X폼즈 프레임워크를 지원하고 있다.
MVC1 vs MVC2 논쟁
This is completely wrong.
- There is only MVC and not MVC1 or MVC 2.
- MVC is a design pattern. MVC does not depend on or require Struts.
- Struts facilitates applying the MVC pattern, however it can also implement Model 1.
- MVC1 is NOT synomonous with model1. (synomonous: synonym)
- MVC2 is NOT synomonous with model2. (synomonous: synonym)
- Model 2 most properly describes the application of MVC in a Web-Application context.
좀 더 보기 편한 버전
Think_about_mvc_pattern.png
See also
- Design pattern
- Spring
- Model View Controller pattern (MVC)
- Model View Presenter (MVP)
- Model View Viewmodel (MVVM)
Favorite site
- Wikipedia (en) MVC 패턴에 대한 설명
-
What are MVC1 and MVC2 Design Patterns? - MVC 구조의 이해
- IBM: Struts, 오픈 소스 MVC 구현
- What is MVC1 and MVC2 Architecture?
- Beyond MVC: A New Look at the Servlet Infrastructure
- Java SE Application Design With MVC
- Drug Runner: Final Draft: 1. Architectural Design and Implementation: 1. Model-View-Controller Architecture
- Model1과 Model2의 차이점