Model View Controller

Model–View–Controller (MVC) нь ПХ-ийн архитектер бөгөөд[1], ө/х-л ПХ-ийн инженерчилэл-д ашиглагддаг архитектур загвар юм . Энэхүү загвар нь бизнес логикийг дэлгэцийн зохиомжоос тусгаарласнаар тест болон хөгжүүлэлтийн дараа арчилгаа тордолгоо хийхэд биеэ дааж ажиллах боломж олгоно. The model is used to manage information and notify observers when that information changes. The model is the domain-specific representation of the data upon which the application operates. Domain logic adds meaning to raw data (for example, calculating whether today is the user's birthday, or the totals, taxes, and shipping charges for shopping cart items). When a model changes its state, it notifies its associated views so they can be refreshed.
Many applications use a persistent storage mechanism such as a database to store data. MVC does not specifically mention the data access layer because it is understood to be underneath or encapsulated by the model. Models are not data access objects; however, in very simple apps that have little domain logic there is no real distinction to be made. Also, the ActiveRecord is an accepted design pattern which merges domain logic and data access code - a model which knows how to persist itself.
The view renders the model into a form suitable for interaction, typically a user interface element. Multiple views can exist for a single model for different purposes. A viewport typically has a one to one correspondence with a display surface and knows how to render to it.
controller нь оролтуудыг хүлээн аваад моделийг дуудаж хариу буцаах үйлдлийг бэлдэнэ.controller нь оролтуудыг зөвшөөрч тэрхүү оролтууд дээр үндэслэгдсэн үйлдлүүдийг model-ийн тусламжтайгаар боловсруулах үүрэгтэй.

MVC загвар Вэб апликэйшн хөгжүүлэлтэнд их ажиглагддаг бөгөөд HTML эсвэл аппликэйшн-ээр хөрвүүлэгдсэн XHTML нь view-гийн үүрэг гүйцэтгэдэг. Controller нь GET эсвэл POST-оор өгөгдлийг аваад юу хийхээ шийднэ( голдуу model дээр байгаа обьектуудыг ашиглан бизнесийн үйл ажиллагааг хийнэ)
Бусад харах
- Trygve Reenskaug—first formulated the model–view–controller pattern
- Architectural patterns
- Model View Presenter
- Model 1
- Model 2
- Three-tier (computing)
- The Observer design pattern
- The Template Method design pattern
- The Presentation-abstraction-control (PAC) pattern
- The naked objects pattern, often positioned as the antithesis of MVC, though Reenskaug suggests otherwise
- Model–View–Adapter
- Model View ViewModel
- Application View Controller an alternative to Model View Controller
- ↑ Reenskaug, Trygve. "MVC XEROX PARC 1978-79". Татаж авсан: 2008-06-09.