Thursday, April 19, 2007

The Value of Consistency and Discoverability

Today I found myself taking the code download from a book I’m reading (Dependency Injection in .NET) and restructuring the solutions and sample projects that it contained according to my employer’s project structure standards and guidelines (which, incidentally, I helped to create and currently maintain).

Then I found myself wondering “Why am I doing this?” and “What value is added by this extra effort?”.  This code will never be part of an official project or effort that I’m working on.  I don’t intend to use this for anything other than my own self-education.  Then it finally dawned on me…

There is unimaginable value in consistency and discoverability – repeatedly achievable results.  What does a McDouble taste like if you get it from your local McDonald’s…or a Big Mac?  How is it dressed?  I’m betting that it is probably consistent with the same orders from my own local McDonald’s and that these locations have similar, if not identical, menu options…and therein lies a good portion of their value and appeal to such a wide consumer market.

In the code download, I wasn’t so much interested in the samples themselves (those are covered in the book), but in the accompanying unit tests (something that I still sometimes struggle with).  Placing these projects and solutions into a common structure allowed me to easily identify the tests accompanying the code and their relationship to the samples.

Enterprise Library 3.0 tests and Windows Vista

Well, I've downloaded, installed, built, and tried to run the tests for Enterprise Library 3.0. I am impressed that they have added perhaps 2000 or so new tests for the functionality. Unfortunately, in my first test run in VS, there were 146 failures. In the EntLib 2.0, I would typically get 2 or 3 failures as a result of timing issues (most notably when writing to the Event Log and determining number of entries written, or raising WMI events and turning around to see the number of events raised). Re-running just these tests made those issues go away.

I suspect that some of the problems I'm having getting the tests to pass go back to Windows Vista and UAC (User Account Control). I run as non-admin (as any good developer should) in my day-to-day activities, but even running these tests as a member of the Administrators group fails under Vista (yes, I know the group SID is not enabled by default). Finally, running as an 'elevated' Administrator allows most of the tests to pass (36 failures as of last run...investigating now). I want repeatable results.

Let say that I just expected more... Either a "To execute the tests as non-admin..." section in the documentation, or a "For Windows Vista users and administrators" section. Maybe even "the unit tests provided have the following dependencies" (cough). Perhaps the EntLib team (and Microsoft in general) should look up the definition of 'unit tests', as this has been sullied enough by Team System and is confusing (mis)information for novices looking for guidance.

Don't get me wrong, I love Microsoft. They have been, directly or indirectly, responsible for my paychecks for the past 15 years or so. They are learning; it's just...slowly.