Basics of MVC
In MVC, User Interface acts as the View; Business logic acts as the Model and the link which provides the link between the View and Model is known as the Controller. In real time business, MVC is used anywhere, where users have a choice to select his or her view. For example, Windows Media Player, Gmail or Yahoo mail and so on. All these type of application provides us the option to select the skin as per our choice.
Let’s take an example: We have to develop one Sales report for our corporate intranet. This report must have the option to display the sales data in the classical report format; different charts – pie, bar, line or both – report & chart and it must be based on the User’s choice. This type of requirements where we can easily separate the Business logic and the views are the best candidates for MVC.
Generally, Model sends the data to controller and controller will pass that data to Views and views will display the data as per their nature. In SAP, our business logic(model) will not send data unless and until View request for an data because ABAP is event driven language. Like user has to run some transaction to get the data, means application view has to initiate the process and ask for the data from the Model. In this requesting process, Controller will help the view to be apart from the model.
UML for MVC
UML diagram of the typical MVC application would be:
As we can see here, Model will send the data to the Controller and controller will pass that information to the View. Now, its a view’s responsibility to create a user specific view – Report, or Chart.
No comments:
Post a Comment