To MVC or not to MVC...

Chris Anderson doesn't like MVC, and John Lam agrees with him - I don't.

The lack of MVC in Windows.Forms has been one of my main disappointments with C#. I hate having to add code to manually update the UI every time something changes in the model. Hearing about Swing and MVC was actually one of the main things that attracted me to Java years ago and made me switch from Delphi (which has a UI-framework that looks remarkably like that of C#... - I wonder why?) to Java.

Chris seems to think MVC adds unnecessary complexity. In reality, it's easy to do non-MVC development in Java (just use one of the DefaultModel classes). If you need a more involved solution though (and IMHO, most systems do), MVC will give you an simple, elegant, yet powerful solution, while it's C# that forces you to add unnecessary complexity because you manually have to keep your model and view in sync. This complexity could have been prevented had Microsoft opted for an MVC approach.


IMHO MVC is something you build on top of the framework, not something you build into it..

Look at MFC. You can separate the Win32 wrapper stuff from the Doc/View achitecture, and simply use MFC as a nicer interface to Win32. That's what the .NET framework is today, an OO reimplementation of Win32.

Doc/View is built into MFC, and if you want to use a different app architecture, then you end up fighting it (or ignoring it, which is easier to do these days). I'd rather not have an application architecture built into the base framework.

(But I do want one.. :)

Posted by Steve Tibbett at February 8, 2003 6:19 AM

I've spent a lot of time reading about separate MVC implementations, and pondering about how things should work. I've written a small UI library for Python called Kiwi that embodies a lot of things that I've concluded from this study. It's based on PyGTK so it does use a couple of wrappers, but the nice part is that there are actually a couple of docs. For an idea: - the last page even has some comments on other toolkit implementations from my viewpoint.

The Kiwi Proxy is a bit like a MVC View/Controller pair. Changes to the model update the interface; and vice-versa. It actually works, too.

MVC isn't the perfect solution. IMO it doesn't scale to application or even window-sized bites; you're better off with simple views and tying up signals yourself. But it's a good basis to start and explore possibilities to organize your interfaces, and that's worth a lot already.

Posted by Christian Reis at February 10, 2003 8:00 PM
This discussion has been closed. If you wish to contact me about this post, you can do so by email.