MVC Architecture

MVC Stands for Model View Controller.

SAPUI5 utilizes the MVC design pattern to isolate the display of data from user actions, ensuring that it remains unaffected by diverse user interactions.

Following the standard design pattern of MVC architecture, SAPUI5 enables the development of desktop, tablet, and mobile applications with strict adherence.

Model : 

  • Model is like database, as it is responsible for storing the data utilized by the application.
  • It displays the stored information to the user upon request, based on the user's needs and requirements.
  • Responsible for managing the application data.
  • Has methods or functions by which we can play or perform operations on that data.
  • There are 4 types of models in SAPUI5.

    1. JSON Model
    2. XML Model
    3. Resource Model
    4. OData Model

View : 

  • View is a User Interface.
  • Responsible for defining and rendering UI.
  • When a user sends a request from device, the view is responsible for data view as per the request submitted.
  • SAP Provides 4 predefined view types.

    1. JavaScript View
    2. XML View
    3. HTML View
    4. JSON View

Controller :

  • Controller contains the logic (ex: Button Press logic).
  • Controllers are based on model.
  • Controller reacts to view events and user interaction by modifying the view and model.

  • It controls the data flow into model object and updates the view whenever data changes.

  • SAPUI5 provides the following predefined methods in controller.
    1. OnInit
    2. OnBeforeRendering
    3. OnAfterRendering 
    4. OnExit

MVC Advantages:

  • Code Re-usability.
  • Development of the application becomes fast. 

  • Easily Modifiable.

Overall, the use of the SAPUI5 MVC architecture provides several benefits that make it easier to develop, maintain, and scale applications.

Thank you for reading this blog. If you have any questions, Please contact us. We are happy to help you 😊.


No comments: