Model View Controller Application Block in .NET

0 comments suggest edit

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.

Found a typo or error? Suggest an edit! If accepted, your contribution is listed automatically here.

Comments

avatar

6 responses

  1. Avatar for Dimitri Glazkov
    Dimitri Glazkov July 14th, 2005
  2. Avatar for haacked
    haacked July 14th, 2005

    Great! Don't you know I don't have the time to be reading memos!!! ;)

  3. Avatar for Srdjan
    Srdjan July 15th, 2005

    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

  4. Avatar for shriop
    shriop July 17th, 2005

    Thanks, I didn't even know it existed.

  5. Avatar for Steven Campbell
    Steven Campbell July 18th, 2005

    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.

  6. Avatar for Haacked
    Haacked July 19th, 2005

    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.