You’ll Use This Design Pattern if You’re Cool

Jul 12 2009

nktb_together1

I can’t help but notice that as much as developers like to think that they are these robotic drones of intellect who weigh the pros and cons of any architecture, they are actually highly susceptible to fan-boyism (yes, that’s a word).

Developers and Software Architects love playing with the latest and greatest programming patterns and technologies. They’ll go to great lengths to try and incorporate them into their latest projects. Sometimes they even leave companies and move on to other ones to get to use these languages and tools.

Let’s look at some quick examples of what is currently Hot and what is Not:

HEART1Hot 

  • Ruby on Rails
  • iPhone Programming
  • ASP.NET MVC

Sad FaceNot 

  • Cold Fusion
  • Java
  • ASP.NET Web Forms

Notice Any Patterns?

Take a look at those lists and what stands out to you?

  • First, those that are Not Hot, were actually pretty Hot not that long ago. In the late nineties, Java was THE programming language for all the cool kids to be using. Then rails came along, and all the Java developers moved other there. Sorry Java :(
  • Second, ASP.NET Web Forms was THE ultimate web application development platform from around 2002 until it’s little brother ASP.NET MVC came out and stole all its coolness. Sorry Web Forms :(
  • Third, Can you spot the biggest pattern of all? I’ll give you a clue. All of the Hot languages use this pattern, and one even has it in it’s name….

You’ll Use MVC If You’re Cool

mvc

That’s right! All of the Hot programming frameworks use MVC. Somehow MVC, which went to an early grave with Smalltalk, has been resurrected! So what has brought MVC back? Is it the end-all be-all design pattern? Did we just miss it the first time around?

I think there are a few things that make MVC stand-out to the “in” crowd:

1) Enforces Separation of Concerns: This was best described in a Stack Overflow answer by Bill Karwin:

The idea of MVC is to decouple the application architecture into three independent tiers, and allow each of these tiers to use a different implementation without affecting the other tiers. Mostly the distinction is between business logic (the Model) and presentation (the View).

The Model, View, and Controller each has a specific role in the application and the MVC pattern helps to enforce it. The Model handles the data. The View renders the UI, and the Controller provides the brain and communicates between the two. Separation of concerns is not a new idea, but it is a compelling and popular one.

2) Testability: You can’t fight the wave of TDD love that is flowing through the community. I mean, if you’re not creating tests, are you really a true programmer? One of the things that people really struggled with in ASP.NET web forms was how to create proper unit tests against the UI. It typically involved binding to HTML elements and was highly brittle.

The MVC pattern solves all of this by allowing users to directly test the controllers which contain the majority of the logic. It also helps if the views stay dumb:

But How Long Will it Last?

MVC does offer some real benefits and for now, it is the de facto pattern for creating software. I encourage you to check it out.

That said, no one can say how long MVC will rule the minds and hearts of the development community. But if history is any guide, some day soon they’ll be a shiny new pattern and MVC will join the ranks of New Kids on the Block and tight-rolled jeans

View Comments

  • Foo

    Well… Agree and disagree. Patterns and methods are always evolving. The big point you didn’t mention is the reason of separation of concerns. And that is change and how easier it is to refactor in change to an app to one of the hot and newer design patterns. Web forms might be old but is still recommended for most “Microsoft web” shops.

  • Um…. Me?

    ok, I don’t know what the last guy said, but that video was frickin hilarious

  • Bryant

    I’m just amazed at how well they timed that jump in the opening sequence.

blog comments powered by Disqus