473,404 Members | 2,174 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,404 software developers and data experts.

MVC & MVP

Hi guys,

I wanted to know whats the difference between MVC and MVP pattern.

Thanks
Jun 27 '08 #1
2 1231
First, I must add a caveat that this answer pertains to MS's implementations
of these patterns. This is not that important, overall, but I am focused on
how MVC and MVP are implemented in .NET (MVC Framework versus Web Client
Factory), so there are some bits that may not apply to a generic MVC vs. MVP
discussion.

MVC uses three basic components, although you can put logic across many
individual classes and even into separate libraries in separate assemblies.
The three are Model (business model, which most commonly is a collection of
business objects, which may be represeted as a DataSet in thinner
implementations), view (UI) and controller (piece that marries the two.

MVP adds a view interface, which separates concerns a bit more, at least in
theory. The presenter and view are not coupled tightly as the view and
controller are, at least in theory.

Differences:
For practical purposes, the controller is in charge of everything except the
data (model) and the UI (view). This means the controller handles all
interaction, the UI is just a veneer. It is responsible for correct
rendering of the model it gets married to, but it does not handle events,
etc. This also means all actions have to be declaratively linked back to the
controller. That is MVC.

With MVP, the UI is not tightly coupled to the Presenter (or at least not as
tightly coupled). It can contain some UI related logic (not present in MVC)
and different UIs can be used by the presenter based on actions. The
controller can also do this, but the view must be bound to the controller to
work.

Why choose one over the other?
In short, it is a simplicity versus extra power thing. And, since most of us
do not need the extra decoupling of UI from presenter, the MVC pattern will
fulfill our needs.

NOTE: If you further separate the logic out into tiers, you can end up with
an extremely thin controller and have models that are data representations
without any type of access logic. Once you ahve done this, you can reuse
this logic in MVC, MVP, Silverlight, WPF, Windows Forms, etc. The point
being that the MVC Framework forcing of separation of concerns is not
necessary if separation of concerns is your primary reason for adopting the
pattern. Hope I did not muddy the water with this trip to the soapbox. :-)

--
Gregory A. Beamer
MVP, MCP: +I, SE, SD, DBA

Subscribe to my blog
http://gregorybeamer.spaces.live.com/lists/feed.rss

or just read it:
http://gregorybeamer.spaces.live.com/

*************************************************
| Think outside the box!
|
*************************************************
"jack" <ga**********@gmail.comwrote in message
news:e4**********************************@q1g2000p rf.googlegroups.com...
Hi guys,

I wanted to know whats the difference between MVC and MVP pattern.

Thanks

Jun 27 '08 #2
MVC is the classic isolation of the view layer from the application
layer. typically there is a message system to pass messages between the
layers. This allows good separation of the UI layer from the application
layer.

Those that use TDD (test driven design) want less logic in the UI layer
as its hard to write unit tests for UI elements (as few come with
mocks). Thus MVP was born. It abstracts the UI behaviors (clicks, hides,
setting UI properties) from the UI layer (event, etc) into their own
layer. this allows units tests to be written for the behaviors. The MVP
is just an extension of the MVC pattern.

-- bruce (sqlwork.com)

jack wrote:
Hi guys,

I wanted to know whats the difference between MVC and MVP pattern.

Thanks
Jun 27 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Collin VanDyck | last post by:
I have a basic understanding of this, so forgive me if I am overly simplistic in my explanation of my problem.. I am trying to get a Java/Xalan transform to pass through a numeric character...
1
by: DrTebi | last post by:
Hello, I have the following problem: I used to "encode" my email address within links, in order to avoid (most) email spiders. So I had a link like this: <a...
0
by: Thomas Scheffler | last post by:
Hi, I runned in trouble using XALAN for XSL-Transformation. The following snipplet show what I mean: <a href="http://blah.com/?test=test&amp;test2=test2">Test1&amp;</a> <a...
4
by: Luklrc | last post by:
Hi, I'm having to create a querysting with javascript. My problem is that javscript turns the "&" characher into "&amp;" when it gets used as a querystring in the url EG: ...
4
by: johkar | last post by:
When the output method is set to xml, even though I have CDATA around my JavaScript, the operaters of && and < are converted to XML character entities which causes errors in my JavaScript. I know...
8
by: Nathan Sokalski | last post by:
I add a JavaScript event handler to some of my Webcontrols using the Attributes.Add() method as follows: Dim jscode as String = "return (event.keyCode>=65&&event.keyCode<=90);"...
11
by: Jeremy | last post by:
How can one stop a browser from converting &amp; to & ? We have a textarea in our system wehre a user can type in some html code and have it saved to the database. When the data is retireved...
14
by: Arne | last post by:
A lot of Firefox users I know, says they have problems with validation where the ampersand sign has to be written as &amp; to be valid. I don't have Firefox my self and don't wont to install it only...
12
by: InvalidLastName | last post by:
We have been used XslTransform. .NET 1.1, for transform XML document, Dataset with xsl to HTML. Some of these html contents contain javascript and links. For example: // javascript if (a &gt; b)...
7
by: John Nagle | last post by:
I've been parsing existing HTML with BeautifulSoup, and occasionally hit content which has something like "Design & Advertising", that is, an "&" instead of an "&amp;". Is there some way I can get...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.