Devlico.Us
CodeBetter.Com
RSS 2.0 via Feedburner
           Do you Twitter? Follow us @devlicious

Derik Whittaker

Thoughts on Software Development, .Net, OOP, Design Patterns and all things cool



My wish list for the ASP.Net MVC Framework going forward.

I have been using the MVC framework now for 3+ months.  In fact I already have a public production site running on the framework (www.dimecasts.net).  I have to say that I am really, really happy with the progress and direction that the team is making. 

But I do have a few things I would like to throw out there as my 'Wish List'

  1. Do not seal any classes's.  There is no need to seal anything.  Once you seal stuff you are saying that no-one will EVERY want to make use of this class in a slightly different way.

    Examples: AuthorizeAttribute & HandleErrorAttribute.

    *** NOTE ***
    I have already been told per Scott Gu that this is going to happen in future releases, but just putting my wish out there.
    *** NOTE ***
  2. Try to make as much stuff as possible virtual (overrideable for you VB'ers out there).  This will allow us to extend our applications to better meet our needs.
  3. Make use of more Interfaces.  Since testing is really high on the list of priorities for the MVC using more interfaces for classes would simplify mocking and testing.

    Example: Anytime a ControllerContext is used (attributes) it is extremely painful to mock these things our for testing.
  4. Do not become afraid to implement breaking changes
  5. Keep up the good work.  I am really enjoying using this framework as I feel it makes my development experience much better.

So there you go, my simple little wish list for the team.  I know it is nothing earth shattering, but I just wanted to get that out there.

Till next time,

[----- Remember to check out DimeCasts.Net -----]



Comments

ASP.NET MVC Archived Blog Posts, Page 1 said:

Pingback from  ASP.NET MVC Archived Blog Posts, Page 1

# August 5, 2008 8:59 AM

Dew Drop - August 5, 2008 | Alvin Ashcraft's Morning Dew said:

Pingback from  Dew Drop - August 5, 2008 | Alvin Ashcraft's Morning Dew

# August 5, 2008 9:08 AM

me said:

Please change "no one will EVERY" to "no one will EVER" ... thanks.

# August 5, 2008 11:36 AM

me said:

Please make a Dimecast about the power of Interface-based programming.  I'm trying to grok it.

# August 5, 2008 11:37 AM

Bill Sorensen said:

The attributes are likely sealed due to the FxCop performance rule: Avoid unsealed attributes.

# August 5, 2008 1:42 PM

Brian said:

I'd be weary about striving for everything to be interface based.

Putting interfaces in just for the sake of testing frameworks is adding extra moving parts and incurring extra maintenance costs. Because now each time you want to add on to something you have to add on to the interface and any classes that implement; plus your making a more complex system for the next guy to figure out/maintain/extend.  Fowler says something about that in an article.

That's almost as bad as having less/no security so you can test your application, or incorrectly scoping your properties or methods for a testing framework.  You're building the application for the customer, not the NUnit/NMock.  And to be fair, there is a trade off there, but there's also a point of diminishing returns.

To me it's the equivelant of saying (in 1998); no current video cards can support the type of vector graphic we'd need for this video game...we'd need at least 128MB of memory for that.  So let's just make all the game manufacturers out there use the current version of direct x, dumb down our game, and not let's try to solve the real problem, or put pressure on the manufacturers out there solve the core problem.

Feeding to the 'build more interfaces so I can test' is dangerous to our industry.  Myself and others have been testing for years without that, and while painful sometimes, I haven't traded security/maintenance/complexity for it and I rather have the occasional painful moment than add extra moving parts for a test framework.  You build your test once - you maintain and extend your application for years.  

Use interfaces where they're needed - where the interacting object is unknown and virtually anything that matches a certain signature.

Maybe as a community we should try to solve the problems we have with testing frameworks that cause us to have to hack our applications with unneeded interfaces, making methods public that should be private, reducing security, and in general just introducing more moving parts into our system.

Just food for thought.

# August 5, 2008 9:43 PM

Christopher Steen said:

Link Listing - August 5, 2008

# August 5, 2008 11:26 PM

Link Post For August 7 2008 | One .Net Way said:

Pingback from  Link Post For August 7 2008 | One .Net Way

# August 6, 2008 8:38 PM

Derik Whittaker said:

@Brian

I am in no way saying that I want interfaces on everything.  What I am saying is i would like them in places where it makes sense (to me).

For example.  When you base a class off of the FilterAttribute it exposes a method 'OnAuthorization'.  This method has a single parameter AutherizationContext.   When I was writing my code in this method I would have liked to be able to better/easier test this, but was not able to because a concrete class was used and mocking that was very, very painful (lots of moving parts have to be mocked).

Had it implemented an interfaces say 'IAutherizationContext' I could have very easily mocked this and written my tests.

This is what I am referring to by wanting interfaces used more.

# August 7, 2008 6:18 AM

Recent Links Tagged With "mvc" - JabberTags said:

Pingback from  Recent Links Tagged With "mvc" - JabberTags

# October 19, 2008 4:04 PM

Leave a Comment

(required)  
(optional)
(required)  

Enter the numbers above:
Add

About Derik Whittaker

Derik is a .Net Developer/Architect specializing in WinForms working out the northern suburbs of Chicago. He is also believer and advocate for Agile development including SCRUM, TDD, CI, etc.

When Derik is not writing code he can be found spending time with his wife and young son, climbing on his bouldering wall, watching sports (mostly baseball), and generally vegging out. Check out Devlicio.us!

Our Sponsors

Red-Gate!