What is the difference between Presenter and Controller in MVC?(MVC interview questions with answers)

First of all of them are UI patterns, means they will deal with the problems in UI.

Controller – 

  • Handles user interaction logic or in short contain methods which get called automatically in response to user events.
  • It will decide which UI need to be sent to user as a response to request.
  • In .net world can be created only in web projects.
  • Talk to Model for Data and then bind UI with that Data. Hence we say Controller is something which know about both Model and View.
  • Here View will be unaware about Controller.

 Presenter – 

  • Handles
           o   Presentation logic in UI. Example – Show button in Red color when value is greater than
                100.
           o   User interaction logic in UI. For that developer explicitly handle UI events and then
                corresponding methods in presenter. 
  • It knows whom to talk in order to get some data that is model.
  • It strongly follows an Object oriented principle “Program to an interface not to concrete classes”. It knows about View by means of Interface.
  • It passes data back to view for display data, but indirectly using functions defined it Interface.
    Creating and initialing (with correct View) interface object in Presenter is the responsibility of View itself.
    Means we say View knows about Presenter, Presenter knows about Model but unaware about View.

Read 50 MVC interview questions with answers from this codeproject article http://www.codeproject.com/Articles/556995/Model-view-controller-MVC-Interview-questions-and
Are you new to MVC Start with the below MVC step by step video series

Advertisements

About c# and .NET Interview questions

This blog is for developers who want to crack .NET and C# interviews. It has all tips and tricks needed to crack .NET interviews , C# interview , SQL Server interview , Java interview , WCF Interview , Silverlight interview , WPF interview , LINQ interview , Entity framework Interview. Do not forget to watch our Learn step by step video series. Learn MVC in 16 hours:- https://www.youtube.com/watch?v=Lp7nSImO5vk Learn AngularJS Step by Step:- https://www.youtube.com/watch?v=0kmdjqgO9IY Learn Design Pattern in 8 hours:- https://www.youtube.com/watch?v=YDobmucohqk Learn C# and .NET in 60 days:- https://www.youtube.com/watch?v=yh2SrzCkNQA Learn MSBI in 32 hours:- https://www.youtube.com/watch?v=mGPJx3ocFgg Learn SharePoint Step by Step in 8 hours:- https://youtu.be/C2fW76SwJNU
This entry was posted in Uncategorized and tagged , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s