Mvc, mvp & mvvm (erp)

  • Published on
    22-Jan-2018

  • View
    11

  • Download
    1

Embed Size (px)

Transcript

<ul><li><p>Enterprise Resource Planning </p><p> Department of Information Technology, University Of The Punjab, Gujranwala </p><p>Campus. 1 </p><p> University of the Punjab Gujranwala Campus </p><p>Name: Ayesha Maqsood </p><p>Roll No: BT14013 </p><p>Class: BS-IT 7th SEM (M) </p><p>Assignment: MVC, MVP and MVVM </p><p>Submitted To: Sir Zahid Mughal </p></li><li><p>Enterprise Resource Planning </p><p> Department of Information Technology, University Of The Punjab, Gujranwala </p><p>Campus. 2 </p><p>Difference between MVC, MVP and MVVM MVC, MVP and MVVM are most popular design patterns where MVC stands for Model-</p><p>View-Controller, MVP stands for Model-View-Presenter and MVVC stands for Model-View-ViewModel. All these design patterns help developing applications that are loosely coupled, easy to test and maintain. </p><p>MVC Design Pattern: MVC design patterns divides application into three major aspects: Model, View and Controller. </p><p>Model: represents collection of classes that define business logics i.e. business model and data model. It also defines business rules for data as how a data can be altered or </p><p>manipulated. View: represents User Interface components like HTML, CSS, jQuery etc. It displays the data coming from controller as outcome. This also changes model in user interface. </p><p>Controller: It acts as bridge between model and view and processes incoming request from user. It gets request from user via the View, then process users data through Model, and </p><p>passing back the result to View. </p><p> Properties: </p><p> Input is directed at the controller first, not the view. </p><p> There is one-to-many relationship between the Controller. Thats because a single </p><p>controller may select different views to be rendered based on the operation being executed. </p><p> There is one way arrow from Controller to View. This is because the view doesnt have </p><p>any knowledge of or reference to the Controller. </p><p> The controller does pass back the Model, so there is knowledge between the View and the </p><p>expected Model being passed into it, but not the Controller serving it up. </p><p> It limited support to Unit testing. </p><p> It uses where the connection between view and the rest of program is not always available. </p><p> There is loose coupling between Model and the View. </p></li><li><p>Enterprise Resource Planning </p><p> Department of Information Technology, University Of The Punjab, Gujranwala </p><p>Campus. 3 </p><p> This pattern is used by well-known frameworks such as Ruby on Rails, Apple iOS </p><p>Development, ASP.NET MVC, etc. </p><p>MVP Design Pattern: The MVP stands for Model-View-Presenter, this pattern is similar to the MVC pattern, wherein the controller is replaced by the presenter. This pattern divides an application into three </p><p>major aspects: Model, View, and Presenter. </p><p>Model: The Model represents a collection of classes that explains the business model and the data model. It also defines the business rules for data means as how the data can be altered and manipulated. </p><p>View: The View represents the UI components like CSS, jQuery, html etc. It is only responsible for displaying the data that is received from the presenter as the result. This </p><p>also transforms the model(s) into UI. Presenter: The Presenter is responsible for handling all UI events on behalf of the view. This receive input from users via the View, then process the user's data with the help of </p><p>Model and passing the results back to the View. Unlike view and controller, view and presenter are completely decoupled from each others and communicate to each others by </p><p>an interface. </p><p>Properties: </p><p> The input begins with the view, not the Presenter. </p><p> There is one-to-one mapping between the view and the associated presenter means one </p><p>View is mapped to one Presenter. </p><p> The view holds a reference to the Presenter. The presenter is also reacting to events triggered from the View, so its aware of the View its associated with. </p><p> The Presenter updates the view based on the requested action it performs on the Model, but the View is not Model aware. </p><p> It highly supports Unit testing. </p><p> It uses where binding via a data context is not possible. </p><p> View is more loosely coupled to the model. The presenter is responsible for binding the model to the view. </p><p> This pattern is used by frameworks such as for ASP.NET Web Forms applications. </p></li><li><p>Enterprise Resource Planning </p><p> Department of Information Technology, University Of The Punjab, Gujranwala </p><p>Campus. 4 </p><p> MVVM Design Pattern: MVVM stands for Model-View-View Model. This pattern supports two-way data binding between view and View model. This enables automatic propagation of changes, within the state of view model to the View. Typically, the view model uses the observer pattern to notify changes in </p><p>the view model to model. This pattern divides an application into three major aspects: Model, View, and View-Model. </p><p> Model: The Model represents a collection of classes that explains the business model and the data model. It also defines the business rules for data means as how the data can be </p><p>altered and manipulated. View: The View represents the UI components like CSS, jQuery, html etc. It is only </p><p>responsible for displaying the data that is received from the presenter as the result. This also transforms the model(s) into UI. View-Model: The View Model is responsible for exposing methods, commands, and other </p><p>properties that helps to maintain the state of the view, manipulate the model as the result of actions on the view, and trigger events in the view itself. </p><p> Properties: </p><p> Input begins with the view, not View Model. </p><p> There is many-to-one relationship between View and View Model means many view can be mapped to one View Model. </p><p> View has no idea about the Model in MVVM pattern, this is because, as far as the View </p><p>knows, it Model is the View Model (hence its name). </p><p> There is rich communication between the View and View Model, isolating the View from </p><p>having to know anything about whats really happening behind the scenes. </p><p> It goes hand-in-hand with Unit testing. </p><p> It uses where binding via a data context is possible. </p><p> MVVM promotes separate concerns between view, user interaction logic, behavior and </p><p>model that leads to its loose coupling. By this, you can easily replace view without affecting View Model. </p><p> This pattern is used by frameworks such as WPF, Caliburn, Silverlight, nRoute, and more. </p></li></ul>