Thursday 26 July 2012

Model-view-Controller (MVC)

  • MVC architecture in .net is useful in the independent development, maintenance and testing every component without interrupting with the other. 
  • MVC.Net is often used in the web platform that uses either HTML or XHTML. 
  • MVC pattern in asp.net can be very flexible for the programmers as testing, design, maintenance and development can be effectively handled. 
  • MVC  applications functions distinctively in that the user interacts with the user interface and the controller will be able to handle the information from the interface. Both the end users and the software programmers are highly benefited by this software.
  •  Hence the use of MVC architecture c# programs can be highly beneficiary for any business holders. Asp .net MVC design and development can be faster in processing and can they can keep the system performance high. 
  • Let us see the three components
What is a Model?

  • MVC model is basically a C# or VB.NET class
  • A model is accessible by both controller and view
  • A model can be used to pass data from Controller to view
  • A view can use model to display data in page.
What is a View?

  • View is an ASPX page without having a code behind file
  • All page specific HTML generation and formatting can be done inside view
  • One can use Inline code (server tags ) to develop dynamic pages
  • A request to view (ASPX page) can be made only from a controller’s action method

What is a Controller?

  • Controller is basically a C# or VB.NET class which inherits system.mvc.controller
  • Controller is a heart of the entire MVC architecture
  • Inside Controller’s class action methods can be implemented which are responsible for responding to browser OR calling views.
  • Controller can access and use model class to pass data to views
  • Controller uses ViewData to pass any data to view
Advantages
The main advantage of using the MVC pattern is :
  • That it makes the code of the user interface more testable
  • It makes a very structured approach onto the process of designing the user interface, which in itself contributes to writing clean, testable code, that will be easy to maintain and extend
  • The Model-View-Controller is a well-proven design pattern to solve the problem of separating data (model) and user interface (view) concerns, so that changes to the user interface do not affect the data handling, and that the data can be changed without impacting/changing the UI. 
  • The MVC solves this problem by decoupling data access and business logic layer from UI and user interaction, by introducing an intermediate component: the controller. This MVC architecture enables the creation of reusable components within a flexible program design (components can be easily modified)
Limitations
  This design approach is not suitable for smaller applications. It Overkills the small applications.

No comments:

Post a Comment