The Next Home of Chris Chapman's Free Thoughts on Agile, .NET, SharePoint, what-have-you, whatnot. 
Page 1 of 1 in the designPatterns category
# Wednesday, November 14, 2007
Update:  'Seems I'm not the only one who's excited about the TDD potential that ASP.NET MVC opens up.  Phil Haack is already all over this one with his post Writing Testable Code Is About Managing Complexity.

I’m trying to curb my enthusiasm here, but I’m excited after reading this first part of ScottGu’s in-depth coverage on his team’s upcoming ASP.NET MVC Framework that we can expect to see in VS2008.

What’s got me really keyed-up is the potential that the MVC model will give us for unit testing web applications.  I could care two figs about the latest syntactic sugar that the product teams think we all want – they’re useless if I can’t do TDD (test-driven-development) and CI (continuous integration) against them.  And ASP.NET web apps have been public enemy #1 for most attempts to unit test – witness: SharePoint.

Here’s how Scott sees TDD happening under MVC (emphasis mine):

…part of what makes an MVC approach attractive is that we can unit test the Controller and Model logic of applications completely independently of the View/Html generation logic.  As you'll see below we can even unit test these before we create our Views.

The ASP.NET MVC framework has been designed specifically to enable easy unit testing.  All core APIs and contracts within the framework are interfaces, and extensibility points are provided to enable easy injection and customization of objects (including the ability to use IOC containers like Windsor, StructureMap, Spring.NET, and ObjectBuilder).  Developers will be able to use built-in mock classes, or use any .NET type-mocking framework to simulate their own test versions of MVC related objects.

Mvc_testproject

Pct_test

The striking thing I see out of all of this is that Scott is envisioning an entirely new way of advancing the development paradigm:

  1. ASP.NET MVC incorporates a best practice design pattern that’s long been known outside of our camp and one we’ve really wanted;
  2. It’s taking some positive cues from our Ruby on Rails bretheren (eg. Models, Views and Controllers folders, ease of testing);
  3. It is an alternative to, not a replacement for standard ASP.NET webforms – you can quite happily live in a coding cave if you wish;
  4. You may use integrated MSFT technologies for testing and dependency injection, or use what you like, eg. NUnit, xUnit, Windsor, etc.

I like this.  I like this a lot.  I’m also hoping to hell that the higher-ups don’t foul this up for the rest of us – ScottGu’s on the right wavelength here and I’m really impressed he’s advancing so far with this.

Wednesday, November 14, 2007 9:01:01 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0] -
.net | asp.net | better practices | design patterns | unit testing

# Saturday, July 24, 2004

Despite my previous posting, I am a technical book nut.  I have dozens of 'em on my shelf at home and have brought a few to work.  I estimate that over the past five years I've probably spent about $1,500 - $2,000 on various technical books and magazines covering all manner of topics.

However, my favorites focus on best practices for software development.  Here are a few of my picks with links to Amazon.ca where they can be found:

The Pragmatic Programmer:  From Journeyman to Master

The authors of this book are well-known old hands at the game of software development and have amassed a considerable amount of what I find is often in short supply for most software projects:  common sense.  This book reads very easily with plenty of examples to illustrate their concise and cogent pragmatic principles.

The Mythical Man-Month

A must-read for anyone in the software business, from developers to project managers.  This book is like The Art of War for software.  Written in 1975 by the “father of the IBM System/360”, Fredrick P. Brooks, The Mythical Man-Month is a review of some of the worst practices in software projects and how to avoid them.  Like Sun Tzu, Brooks lays out his canvas with broad stroke chapters like “The Tart Pit”, “The Mythical Man Month” and “No Silver Bullet”.  Central to the thesis of the book is the deflation of a common measurement of effort for software projects that persists to this day: “the man-month”.

My favourite premise in the book is Brook's Law: “Adding manpower to a late software project makes it later.”  I've experienced this first-hand.  Too bad no-one on my team had read this book.

Refactoring:  Improving the Design of Existing Code

This book is such a cornerstone of modern computer science that I cannot imagine any CompSci student graduating and not having read it.  It's a sad fact that many have not.  Refactoring is an essential skill that takes time to develop, and is often grounded in instincts about code that the author, Martin Fowler, refers to as “code smells”.  For me, I know code smells when my skin crawls looking at the disorganized chaos of some poorly written classes and methods.  Refactoring is a common-sense guide that shows you how to apply over 35 different “refactorings” to clean up code and make it more robust.  This is a must-have.

Test Driven Development in Microsoft.Net

I am a huge proponent of constant integration and testing during the software development life cycle and the tools that make it all possible.  Central to the concept of writing test code first is a framework to run it in, and that is NUnit.  This book is written by the guys who ported Kent Beck's seminal testing framework, JUnit to the .NET world and have perhaps the best understanding of how to use test driven development in .NET projects.

If you already have a lot of experience using NUnit or Test Driven Development, there's nothing in this book you won't already know.  But even then, it's a great book to have on the shelf to loan out to other colleagues to get them “test infected”.  Think of it as one of those “pay it forward” situations...

C# Design Patterns: A Tutorial
Another book that every developer should have is the the Gang of Four book on design patterns.  It's a bit esoteric today, with examples in C++, so I suggest the C# equivalent.  This book isn't superlative, but it does cover off all the major patterns with some good examples.  I often like to juxtapose the patterns from the book with examples on the Data & Object Factory site.

Patterns are important to software developers, as it is the codification of a principle that originated in building architecture that observed there are common traits in how one approaches solving problems with the construction of buildings.  So too with software.  Another MUST HAVE!

Saturday, July 24, 2004 11:53:19 AM (Eastern Daylight Time, UTC-04:00)  #    Comments [0] -
agile | better practices | design patterns

About Me
I am a Toronto-based software consultant specializing in SharePoint, .NET technologies and agile/iterative/lean software project management practices. Currently, I am employed by Microsoft Consulting Services (MCS) Canada as an Application Development and Information Worker Consultant, focusing on delivering guidance and subject matter expertise to enterprise customers who have or are in the process of deploying Microsoft technologies.

Disclaimer
The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

© Copyright 2010
Chris R. Chapman
Sign In
Archive
<March 2010>
SunMonTueWedThuFriSat
28123456
78910111213
14151617181920
21222324252627
28293031123
45678910
Statistics
Total Posts: 194
This Year: 2
This Month: 0
This Week: 0
Comments: 109
All Content © 2010, Chris R. Chapman
DasBlog theme 'Business' created by Christoph De Baene (delarou)