MVC Architecture in SAPUI5

In Software Development there are various Architectural Patterns you can follow to develop a program/module. Architectural Patterns help us understand, manage, develop and maintain complex high level code better.

Model View Controller is one such Architectural Pattern.
SAPUI5 applications are mostly build on this pattern.

MVC architecture in SAPUI5

In Model-View-Controller ( MVC ) Architecture

Model

is a class which is responsible to
1. Hold/Supply data to the application
2. Has methods or functions by which we can play around or perform operations on that data.

View

is the part of the application which renders on to the presentation layer and

Controller

is the code which controls the View’s behaviour and its communication to the Model.

In SAPUI5

Model is implemented using one of the 4 classes

  • JSONModel
  • XML Model
  • Resouce Model
  • OData Model

View is implemented using UI5 Libraries particularly as

  • JavaScript View
  • XML View
  • JSON View
  • HTML View

Controller is implemented using JavaScript. The Controller class provides 4 hook methods to control the behavior of the Application

  • onInit()
  • onExit()
  • onAfterRendering()
  • onBeforeRendering()

 

 

7 Comments

  1. Michael Riches

    Nice and succinct 🙂

    However I’m not trying to be cheeky, honest!

    But you would say “SAPUI5 applications are mostly buil(t) on this pattern” rather than “SAPUI5 applications are mostly buil(d) on this pattern” in this instance.

    Built is past tense, build is present tense, you could say builded, but no one says that as it’s awkward.

  2. Mohan

    Nice article but the information is not in detail please provide the detailed explanation of UI5 MVC and the control flow i.e How it is routing the control flow.

Leave a Reply

Your email address will not be published. Required fields are marked *