Monday 2 September 2013

What is MVC?

In technology world MVC stands for Model View Controller; MVC is an architectural design pattern to develop the software. MVC design pattern is widely used to develop a web application.

Model: Model represents the real life entity such as customer. Model consists of application data, business rules, logic and functions.

View: View represents the model data on UI or page (web application). View is actual representation of data in user friendly format. View present data in terms of user controls, charts, diagrams etc.

Controller: Controller is mediator between Model and View. It takes model data and represents it on the view. It could also take input from the user and send to the model for further processing or to take action on it by model.

This design pattern is exists since 1970. The MVC pattern is widely used with programming languages such as Java, Smalltalk, C, and C++. Now Microsoft Web Developer can easily integrate this design pattern with Asp.Net application using RAZOR or ASPX engine.


Now next question comes into your mind is that why should I use MVC or what are the advantages of using the MVC design pattern?

Following are the advantages of using MVC pattern

  • Separation of concerns: View is only responsible for displaying data on UI. No business logic is tightly integrated in view. Controller is responsible for processing user requests. Business logic now resides in a model.
  • Unit Testing:  You can test your business logic using Unit test tools such as NUnit, xUnit etc.
  • TDD: TDD stands for Test Driven Development, In TDD approach developer will always writes test first for a module or business logic. This approach is helpful in early detection of an issue in development.         



Custome Service Class to connect wcf service

  using  System; using  System.ServiceModel; namespace Custom.Service.Client {      // Borrowed from: http://old.iserviceoriented.com/blog/p...