Model View Controller Application Block in .NET

Ok, one of you forgot to send me the memo about the MVC application block released by Microsoft. Fess up. Who forgot to send the memo?

Perhaps I missed this because they chose the name “User Interface Process Application Block” (“UIP” for short). A name that means very little to me and would not catch my attention. Not a big deal, but it seems to me that “MVC Application Block” would catch developers attentions more to its real use, unless there really is more to it than just MVC (which I have not yet investigated).

Just recently I was working on a UI that could have benefitted from the MVC pattern. I decided not to roll my own at the moment since I was trying to rapdily prototype the UI. I was implementing this UI in ASP.NET, but with the idea that a WinForms version could also be useful at some point.

Fortunately, Mark Seeman comes to the rescue with this article, “Easy UI Testing - Isolate Your UI Code Before It Invades Your Business Layer”. Mark succinctly outlines how to implement the Application Controller pattern using the UIP and completes the picture with UI agnostic unit tests (using NUnit) of the controller logic. You know how I loves me some unit tests!

Mark, I owe you a beer for highlighting the real potential underneath this hidden gem of an application block.

What others have said

Requesting Gravatar... Dimitri Glazkov Jul 14, 2005 7:02 PM
# re: Model View Controller Application Block in .NET
Here's another interesting "memo":

http://today.java.net/pub/a/today/2003/12/11/mvc.html

And this one:

http://today.java.net/pub/a/today/2004/01/27/wars.html
Requesting Gravatar... haacked Jul 14, 2005 8:39 PM
# re: Model View Controller Application Block in .NET
Great! Don't you know I don't have the time to be reading memos!!! ;)
Requesting Gravatar... Srdjan Jul 16, 2005 8:38 AM
# re: Model View Controller Application Block in .NET
well then you should know about
Composite UI Application Block (CAB) too:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnpag2/html/CABCTP.asp
Requesting Gravatar... shriop Jul 18, 2005 9:57 AM
# re: Model View Controller Application Block in .NET
Thanks, I didn't even know it existed.
Requesting Gravatar... Steven Campbell Jul 19, 2005 10:52 AM
# re: Model View Controller Application Block in .NET
You're better off without it. Really. ASP.NET (with code-behind) already separates controller and view. Use a model in the form of additional classes, and you're set.

I tried the UI Application Block for a moderately simple web app, because it had several multi-step processes that I thought could benefit. The downside was that the UI block was overly complex, required inheriting from their own base Page class, and did not handle page-backs very well.

In the end, all it really did for me was handle session state, and I can do that in other much simpler ways. I won't use it again.
Requesting Gravatar... Haacked Jul 19, 2005 11:46 AM
# re: Model View Controller Application Block in .NET
Interesting. See that's exactly the scenario where I think this app block could be useful. It's those cases where you have multi-step scenarios where each step is based on the current state of the app.

I have a lot of code that does a switch statement saying if the state is this, do that. I'd essentially like that switch statement to be in an XML file so it's more declarative.

What do you have to say?

(will show your gravatar)
Please add 3 and 4 and type the answer here: