In: Computer Science
what are the general role (purpose) of the Model, View, and Controller. Also, for each of these, tell me how they are implemented in OFBiz?
Model View Controller:
MVC is a software design pattern that is used to design the Graphical User Interface(GUI) and it divides the program logic into three interconnected elements model, view, and controller.
The diagram is given below:
Model:
The Model has the application data and it has the logic to fetch the data to represent to the user. It works directly with the database like insert, fetch, update, delete the data. This doesn't deal with the user interface.
View:
The View is used to represent the data to the end-user. It accesses the data model but this is not aware of the meaning of the data. The view can show the data to the user and to respond to the event.
Controller:
The Controller works between the View and Model. This controls the data flow into the Model and updates the View whenever required.
This pattern is a good object-oriented design because:
OFBiz architecture is based on J2EE, HTML, SOA, OMG GL, W3C, Java, XML, etc. It is a collection of ERP(Enterprise Resource Planning) components.
ERP is used to automate the company business by using a lot of different modules like Account Receivable, Account Payable, Bank, System Administrator, Payroll, General Ledger, etc in a single tool. All these modules are related to each other and share data with each other.
The components of ERP are reusable and these components work as a core to OFBiz.
OFBiz implementation of MVC(Model View Controller) has the dependency between Model, View, and Controller through the XML(Extensible Markup Language). The controller defines the mapping between them.