tags:

views:

169

answers:

2

Seems like there are a ton of possible MVC configurations/architectures (MVC, MVVM, MVP, HMVC, PAC, document-view...). Is there any currently accepted 'best' or state-of-the-art MVC architecture? What is the newest thinking? Or is it all a free-for-all and/or simply tied to whichever platform one develops on (e.g. MVVM for WPF)?

(Specifically I'm interested in MVC as applied in desktop/rich-client applications.)

+3  A: 

The newest architectural research being done these days for Thick Clients is being done by Google. with the MVP architecture.

Check out the GWT articles on MVP
http://code.google.com/webtoolkit/articles/mvp-architecture.html
http://code.google.com/webtoolkit/articles/mvp-architecture-2.html

Also look at this http://groups.google.com/group/Google-Web-Toolkit/browse_thread/thread/8b0ae5eaf84d8bc2?hide_quotes=no

Also check out this YouTube Video http://www.youtube.com/watch?v=PDuhR18-EdM

As far as answering your question, except for saying that MVC is kind of dated, I think it is very subjective on which way to go. It is not platform specific, except that the Framework you pick might dictate the Architecture :(

Romain Hippeau
GWT in the context of desktop/rich client apps?.. also, am I misreading it, or do you really imply that MVP architecture is Google's?
Pavel Minaev
@Pavel GWT is very much like Java Swing. I am not implying that they invented MVP (Not sure who did), just that they are promoting it and have published a lot. Updated my post to where it might be construed that I meant that.
Romain Hippeau
**MVP has been around since the early 90s** and is old news. If the question is asking what the state-of-the-art is, MVP is not even in the running. MVP still has most of the problems that MVC had. You can do far better than that.
Ray Burns
+3  A: 

No. You will not get any agreement on what is the "currently accepted" best architecture.

It is certainly not MVC or MVP. These architectures originated in the late 70s and early 90s respectively. MVP is an improvement on MVC, but in the twenty years since MVP was invented, it has become clear that it suffers from many, many flaws. This is why there are so many new competing architectures.

The concepts of "model" and "view" are well-accepted and seem to be common to all current architecture models nowadays. The real question is how to best link them together. You need something else in addition to the model and view, but what?

Most of the newer architectures tend to do this by having the view link or bind directly to the model and the "something else" using data-binding, expressions, or similar mechanisms. That way anything in the model that can be bound directly by the view has no need of involving the "something else" at all.

My personal favorite is MVVM. I love the fact that a "view model" is conceptually just a "model" with all the aspects of any other model except that it doesn't (normally) ever get written out to disk. In fact, if it weren't confusing "MVVM" could be renamed to "MV", since it pretty much dispenses with the need for anything else but views and models. MVVM can be used not only with WPF but with any presentation framework that has advanced data binding capabilities. Unfortunately this excludes GWT and Cocoa. I also like MVVM because it tends to entirely eliminate redundant or repetitive code.

MVVM is not the only advanced player in town. Aspect-oriented approaches and command archtectures built on traditional models and views also have similar aspirations.

The bottom line is, this is still an actively researched area and there has been no consensus reached at this time. MVVM is the most popular of the new architectures but not the only one. The jury is still out.

Note: To get some idea of how the newer architectures are improvements over MVC and MVP, check out this comparison of Cocoa and WPF starting at the heading "Repetitive code" and going down to the end of the "Command Architecture" section.

Ray Burns
Is there a link to a site that describes MVVM in some detail ?
Romain Hippeau
There are several such sites. The Wikipedia article on MVVM has 12 external links, several of which seem to be what you are looking for. http://en.wikipedia.org/wiki/Model_View_ViewModel Warning: Some of these links describe creating a proxy property in your ViewModel for each of your Model properties, but fail to make it clear that this is *only* necessary or desirable if your Model lacks property change notification. I use a data layer that implements property change notification properly, so I've never had any reason to create such proxy properties when I've used MVVM.
Ray Burns