We will implement the data entry form using the Zen Model–View–Controller (MVC) framework.
The Zen MVC framework provides a quick and easy way to implement a model–view–controller (MVC) architecture and can dramatically simplify your application's code for updating and displaying data.
An MVC architecture separates an application's data (model) from its user interfaces (view) by inserting a layer of code (the controller) between the two. The controller code updates the model in response to user interaction with the view and updates the view in response to changes in the model. This decoupling of data from presentation provides a number of benefits including much greater code simplicity and flexibility.
Here are some of the Zen MVC framework classes and components for implementing each of the different elements of a model–view–controller design:
|MVC Element||Zen Class or Component||Description|
|Model||%ZEN.DataModel.ObjectDataModelOpens in a new tab||
Create a subclass and override several callback methods. Correlate properties with properties of the database classes.
|Model||%ZEN.DataModel.AdaptorOpens in a new tab||
Add this class as a super class to a persistent class. The persistent class and all of its properties become part of the model.
|View||dynaGrid component. All form, chart, and meter components.||
Any component class that extends %ZEN.Component.dataViewOpens in a new tab can be a view.
dataController component or any subclass of %ZEN.Auxiliary.dataControllerOpens in a new tab
Place the component on the Zen page. It manages all communication between the View and Model classes.