Hi
Can anybody explain me what is MVC?
What is difference between MVC & MVP
Hi
Can anybody explain me what is MVC?
What is difference between MVC & MVP
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
SIVAPosted Dec 29, 2011, 4:50 AM
You can refer this nd you can go for our articles also which will clarify your doubts
MVC
MVC is a design pattern to develop the ASP .Net web applications.
its the shorter form of Model View Controller
MVC defines as follows
" The pattern isolates "domain logic"(the application login for the user) from the user interface (input and presentation), permitting independent development,testing and maintenance of each"
According to MVC a program should be written in 3layers
Model: it represents the type that we want to access
View: which provides I/O to user
Controller: it s the most important, which is responsible for handling all the tasks of application..
How MVC application will work
step1 : incoming request directed to controller
step2: controller process request and forms a datamodel
step3: model is passed to the view
step4: view transforms model into appropriate format
step5: reponse is rendered
Sample application :
pre requirements :
Visual studio 2010 with its service pack1
install the MVC3 template
1. start the VS & select the ASP .Net MVC3 application template
2. go to Controller folder--> right click and add a new controller
3. write this method inside of the controller public string Welcome(string s){ return "Welcome "+s;}
4. right click on this method & select add view option to select the view & design the view according to ur wish
5. go to the browser http://localhost/controllername/welcome?s=CSharpCorner
6. now see the result
MVP is a user interface design pattern engineered to facilitate automated unit testing and improve the separation of concerns in presentation logic:
· The model is an interface defining the data to be displayed or otherwise acted upon in the user interface.
· The view is an interface that displays data (the model) and routes user commands (events) to the presenter to act upon that data.
· The presenter acts upon the model and the view. It retrieves data from repositories (the model), and formats it for display in the view.
MVP pattern is one of the major patterns used for extracting business logic outside of UI elements and by that, enabling unit testing the UI without the need for using specific UI based testing tools
View responsibility is to show the data provided by presenter, and purpose of the presenter is to reach to model, retrieve the needed data, performs required processing and returns the UI prepared data to the view.