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

Billy McCafferty



(Re)Assessing Best Practices

As we progress as developers, we strive to seek out the "best" way to perform our craft. The chosen methods to attain this lofty goal always bring with them a number of developmental trade-offs. Some techniques may simplify the code but lessen fine grained control while others enable greater power while introducing complexity. Model-View-Presenter with ASP.NET is a wonderful example of the latter. MVP aims to facilitate test-driven development of ASP.NET applications with the unfortunate introduction of added complexity. So while developers will be more confient in the quality of their product, MVP hinders their ability to easily maintain code. Yes, the tests will (hopefully) inform the developer that a bug has been introduced, but the inherent complexity of MVP makes it difficult for later team members to become comfortable with the code base and maintain it as project development continues.

Fortunately, as time progresses quickly in our field, resources and tools become available which enhance our ability to write powerful applications while simplifying the coding process itself. The introduction of NHibernate, for example, eliminated vast amounts of data-access code while still providing powerful facilities for managing transactions and dynamically querying data. Castle MonoRail (and Microsoft's upcoming spin-off of this framework) now does for writing testable and maintainable .NET web applications what NHibernate (and the upcoming LINQ to Entities) did for ADO.NET. This is not to say that the previous techniques were necessarily wrong, but that they were only applicable considering the developer's toolset that was available at the time of selection.

In adapting to the evolution of our field, it is important for developers to note when an accepted technique is no longer valuable in light of current alternatives. Specifically to this example, MVP was a very powerful technique for writing ground-up, test-driven ASP.NET applications but is no longer a strong candidate for consideration when compared to the time saving benefits and simplicity of Castle MonoRail and Microsoft's upcoming MVC framework. Oddly, it is sometimes difficult to "give up" on something that worked perfectly fine before, but that's the nature of our business...one tenet that's not likely to change anytime soon.

Billy McCafferty



Comments

Sean Chambers said:

Bill,

You hit the nail on the head yet again. I completely agree with your points above.

One thing I would have liked to see was more examples of MVP scenarios when I was first starting with it.

Another thing that would really benefit the community is more examples of mapping with NHibernate. This seems to be one area that alot of people still have trouble with.

All around though, the applications I create now are so much more flexible and able to deal with change at the cost of complexity. Although, the complexity is worth it and can easily be explained to a fellow developer to get him on the right track.

Great post!

# October 15, 2007 4:05 PM

Pete said:

I agree with you that the ability to adapt quickly is a KEY factor in our game. I assume that by the time I master a certain technology, there is better one in the works to replace it within 6 months or so...

Tangent:

Speaking of new technology, one thing I am not completely sold on yet: using LINQ as an ORM. I built a comparison project between LINQ and NHibernate on top of a common database schema. I tested multiplicity, many to many, and inheritance scenarios. I was trying to employ LINQ in an active-record style manner and I found the experience much like pounding the square peg in the round hole.

Perhaps I am too set in my ways, but Im still having trouble finding a good usage scenario for LINQ to sql as of yet.

# October 15, 2007 4:36 PM

DotNetKicks.com said:

You've been kicked (a good thing) - Trackback from DotNetKicks.com

# October 15, 2007 4:37 PM

Mort said:

I don't think NHibernate and Monorail have been built on large enterprise systems.

To me, it still only is relevant in smaller business applications, hobbyist websites, etc...

But, MVC is as a pattern that should be available to any programming language (OO language I should say).

# October 15, 2007 8:25 PM

Billy McCafferty said:

Hey Mort! ;)  From experience, I can VERY confidentally say that NHibernate is fully capable of handling large enterprise systems.  (Due to a non-disclosure agreement, I can't get more specific than that.)  As for MonoRail, I can't say from experience that it's able to handle large enterprise systems...but I'll report back in a couple of years to let you know my opinion!

# October 15, 2007 11:16 PM

Jericho said:

This is only evolution like biological evolution  of ways to create good, predictable, and less fragile software. I think 10 or 15 years ago not as many people as now thought about IOC MVC in their applications.

We can't stop evolution, even big companies like MS influenced by IT evolution. So better late than never MS decided to do something important in their way which will be very important for all ASP.NET community. I think they are on the beam and wish them good luck!

# October 17, 2007 8:32 AM

anortham said:

RE:  NHibernate and Enterprise

I know it works, I'm sitting here looking at it.

# October 19, 2007 12:13 PM

Toby said:

Billy - what does the Tag "Remenissions" mean in this context?  Google only reports that it's the title of a song by Avenged Sevenfold... :)

[ perhaps Ruminations? ]

# November 14, 2007 11:09 AM

Billy McCafferty said:

Heh!  That's funny...yes, ruminations is what I meant.  I've changed it to DeepThoughtsByJackHandey to eschew any further confusion. ;)

# November 14, 2007 11:52 AM

Leave a Comment

(required)  
(optional)
(required)  

Enter the numbers above:
Add
Check out Devlicio.us!

Our Sponsors

Proudly Partnered With