Model-View-Controller

ColdBox is based on the Model-View-Controller development pattern for web applications. MVC is a software approach that separates application logic from presentation. Read below as wikipedia states it:

"A developer often wishes to separate data (model) and user interface (view) concerns, so that changes to the user interface will not affect data handling, and that the data can be reorganized without changing the user interface. The model-view-controller solves this problem by decoupling data access and business logic from data presentation and user interaction, by introducing an intermediate component: the controller." Wikipedia

  • The Model represents your data structures and business logic. The domain-specific representation of the information that the application operates. 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.
  • The View is the information that is being presented to a user, in our case it can be HTML/XML/Raw data. It can be used to build various views, composite views, layouts-view combinations, etc.
  • The Controller serves as an intermediary between the Model, the View, and any other resources needed to process a request. In ColdBox it processes and responds to events, typically user actions, and may invoke changes on the model or any other external feature of the web application. In ColdBox a Controller is called an Event Handler

If you don't need the added separation into a model or find that maintaining models requires more complexity than you want or have experienced before, you can ignore them and build your application minimally using Event Handlers and Views. However, you should know that this is discouraged and if you will be mastering object oriented web applications, you should develop and separate logic into a domain model.

Resources


Copyright 2006 ColdBox Framework by Luis Majano