A seemingly futile discussion on considering XP

The reasons offered by the people for not switching to XP I talk to are so thin that they are practically transparent but yet they can't see thru them. e.g. Some points from a discussion yesterday with another person at work.

Even with auto testing (example here was NUnit) there is a "thin layer" that is never exercised i.e. the user moving the mouse to a particular menu item and clicking it.
I then showed him a test right there which directly called the eventhandler (Tim H. -search "UserInterrogator"- has done one step better by directly firing the event) but somehow it didn't quench his need for an "end-user" testing the app. I questioned his existing testing approach of using manual testing and how it attacks the thin layer but my rhetoric didn't get thru. His very thought of considering NUnit shows that his current approach is not doing the job as well as he liked. The thin layer is always present - i.e. tests not considered by the developer.

He had a customer found defect where he had a grid control which displayed a wrong value even though it's data store had the right value. This special grid is said to have no method to get the displayed value. Additionally he said that querying the grid for the cell value is delegated to the data store and hence NUnit would say that the test had passed. The solution was to refresh the grid after the calculation had modified the data store. I felt this falls in the weird UI control dept.

Next on his list, was that he already had a very huge code-base for a product that is already deployed and he doesn't have the time to write tests. I replied that in this case retrofitting tests is very difficult and not advisable. So what you should do .. the next time you have to make a change for a new defect.
1. Understand the area of the defect.
2. Write tests for that area first. Make all of em green.
3. Write a test for the defect.
4. Make that pass
5. Run all the tests from step 2 again and make sure you haven't broken anything.
6. Do your "Victory jig" (You have one right ? awww...)

After all this discussion, I lost an hour of my day and the person was still not convinced although he kept iterating that he wanted a bunch of tests that he could run at any given moment but no time, too diff... this n that and I hate this proj sustenance, and so on and so forth.
My brain kept yelling 'There's no free lunch dude. You want non-manual self-running test-base. GO WRITE IT!' As usual I muffled the noises in my head 8)

[Update Jan 26, 2008]
Looking back at this.. I realize Mary Poppedieck puts it as clearly as possible in the Google tech talks video. Look in Stuff I bookmarked on the blog home page.

Non-obvious XPath: Getting an element by specifying it's value

This one took around half - an - hour out of my working day.
I needed to get a specific element from an XML document based on its value / element content.
[path]C:\Diablo II\[/path]

So I need a query to get me the element which has the text H.G.Wells. I could find a whole lot of examples on the net to get me an element based on the value of one of it's attribute.
e.g. /root/SomeSection[@attr='value']
or based on one of its sub elements
e.g. /root/SomeSection[path='H.G.Wells']
I tried a whole of things but to no avail. Then I turned to pester one of my buddies Ranjeet here, who turned to a saved ref document.

The answer here is
the dot was my missing link to the solution. Oh well, what the hell...
Here's hoping the next guy finds it sooner

Simpleton pondering over Singletons

Are singletons bad ? (I won't call them evil - coz they don't want to take over the world)


Here's my example

public sealed class LicenseManager : IDisposable
/// The single instance in the entire app

private static LicenseManager m_obLicMgr;

/// Single point to access all LicenseManager members

public static LicenseManager Instance
if (null == m_obLicMgr)
m_obLicMgr = new LicenseManager();

return m_obLicMgr;

Here's one that I just used.. What would the benefit be in just moving the Factory method to anothe class as Scott suggests ? Hmmm... I'll poke around.

XML Comments bug in VS .NET 2003

It seems that no one is using XML Comments generation via the VS.Net 2003 IDE.
Recently I tried getting all projects to generate the Code Comment pages for all projects to a specific folder. I mean, how difficult could that be ?
  1. Get into Project Properties.
  2. Select Configuration Properties in the tree on the left side.
  3. Enter the relative path into the "XML Documentation File" property under the Outputs category.
Bada bing Bada boom.. you're done! Right ? Wrong !
If you try this out, you will see that the IDE is stubborn as a mule with this.
  • You enter a filename like "MyProj.xml" and everything is smooth. You'll get the page allright.
  • Now try something like [..\..\Comments\MyProj.xml] and click Apply. You'll find your setting being unceremoniously dumped by the IDE and reset to the last good value.
  • Tried the forward slash and still the same.
  • Now try the same with the quotes [""..\..\Comments\MyProj.xml"]. You'll find the IDE accepts it this time :o but still won't output the file there. It will give some weird path errors or file creation errors.
  • Next I just plained opened the .csproj file in Notepad and force set the property. Open the project again in IDE, it will again fail citing some inane reason and blank out the property (LGValue).

I spoke to my at-hand ref guru and he said that it might be due to command line issues since the IDE calls csc.exe with the /doc switch to generate these. But then the description for the 'XML Documentation File' property should not have stated 'Path must be relative to the proj directory (/doc)'

In the end I just gave up and downloaded NDoc. Will try to integrate that with my CI Server which is down with the flu. But I bet I can get that setup faster than I can get CodeComments (from the painfully entered XML Comments) via the VS .NET 2003 IDE.

Great Code: Microsoft gets TDD guidelines wrong.

Just read about the whole fiasco from Aniket's blog.
There is no question that the author got it wrong (and got torched).. he has proposed and delivered a speech on his deviation/derivation of TDD. The problem here is the title.. it should have been 'VS.NET 2005 tools for automated testing' not "Guidelines for TDD"
Seconding Ron Jeffries, I too hope that this is not an MS attempt to adopt, contort and pollute the XP stream with IDE-forced/induced deviations from the holy path shown by the "Rev." Kent Beck :) who has led so many like me across the deserts in search of the promised land (where quality code meets mutually accepted deadlines).

2 Books I think a doubter/newcomer should read are
• XP Xplained - Kent Beck
(First AND second editions to know where XP comes from and what it is)
• Extreme Programming Adventures in C# - Ron Jeffries
For a fun, hands-on, fly-on-the-wall look at how to practice XP.

Angst of an Automated Build Enthusiast leads to GetBOB

I am near the end of the rope with keeping my builds automated.
· NAnt failing to build my solution and breaking the back of my CI Server. I spent nearly a day on finding what the hell is going wrong! If the IDE can build it why can't you ? I get a stupid regasm error stating "RegAsm error: File or assembly name XXX, or one of its dependencies, was not found. External Program Failed: C:\WINNT\Microsoft.NET\Framework\v1.1.4322\regasm.exe (return code was 100)"
· CruiseControl.NET also has decided to out do NAnt by just timing out my SourceControl operation. It used to run perfectly till about 2 days ago. Now every build times out with Starteam operations timing out. I manually run a batch and that works :P

I have been trying so very hard to find the cause for it. It's a funny pickle I am in. I have spent too much time setting all this up. Now everything tumbling down like a pack of cards and I don't wanna go back to batch files (which still run as you tell them to. Day in Day out!).

I figured that maybe the NAnt issue was due to some things in the bin or obj folders. I have solved Intellisense lock ups by deleting the bin and obj folders under each project directory. I hunted around for some recursive dir delete switch in the DOS command line utilities. No luck. Next tried NAnt task. Fine help that is ... couldn't figure that one out -- assuming that it is possible. Finally I decided to write one myself - A Bin Obj Blaster - A recursive directory/folder delete utility
You can just paste into a .cs file and compile it as a 'GetBob Console App'. Then configure your PATH variable so that the exe is available everywhere.

>GetBOB.exe -t
(TestMode: lists out all bin and obj folders that would be deleted but does NOT delete it)
>GetBOB -v
(verbose: Lists and deletes all bin and obj folders)
(silent mode - deletes all bin and obj folder directly)
>GetBOB temp*
(this should also work - haven't given it a try. Will delete all folder beginning with 'Temp' in the current folder or it's sub-directories.

It's pretty cool and something I needed for quite some time. Give it a whirl :) and let me know of any quick improvements!

I really need to learn how to post code in a blog. XML Comments and indentations are totally screwing up my blog layout. So please ignore...

using System;
using System.Collections;
using System.IO;
using System.Diagnostics;

namespace CallBOB
class BOB
private static bool bVerboseMode;
private static bool bTestMode;

static void Main(string[] arrDirPatterns)
Console.WriteLine("BinObjBlaster (B.O.B.) - A recursive 'seek and destroy' folder utility");
Console.WriteLine("Created: Gishu Pillai Nov 17, 2005.");
Console.WriteLine("DISCLAIMER: I give everyone the right to copy/use! Use as you please and at your own risk and free will. The author is not responsible for any damages that may occur from using this.");

ArrayList alDirPatterns;
GetDirPatternsForDelete(arrDirPatterns, out alDirPatterns);

if (alDirPatterns.Count == 0)
{ alDirPatterns.Add("bin"); alDirPatterns.Add("obj"); }
{ // we have their number }

DirectoryInfo obDirInfo = new DirectoryInfo(Environment.CurrentDirectory);
SeekAndDestroy(obDirInfo, alDirPatterns);
catch(Exception obExcep)
{ Console.WriteLine(obExcep); }

private static void GetDirPatternsForDelete(String[] arrArguments, out ArrayList alDirPatterns)
alDirPatterns = new ArrayList();
foreach(string sLoop in arrArguments)
if (sLoop.StartsWith("-"))
string sTemp = sLoop.Replace("-", "").ToLower();
if (0 == sTemp.Length)
{ continue; }
switch (sTemp[0])
case 'v':
bVerboseMode = true;
case 't':
bTestMode = true;
case 'h':
Console.WriteLine("List of Available switches");
string sFormatString = "-{0} {1:15} {2}";
Console.WriteLine( sFormatString, "t", "Test Mode", "Prints a listing of directories that would be deleted but does NOT Delete them");
Console.WriteLine( sFormatString, "v", "Verbose Mode", "Prints the name of the deleted directories");

alDirPatterns.Add( sLoop );
catch(Exception obExcep)
{ Console.WriteLine( obExcep ); }

private static void SeekAndDestroy(DirectoryInfo obCurDirInfo, ArrayList alDirPatterns)
foreach(string sDirPattern in alDirPatterns)
foreach(DirectoryInfo obDirForDelete in obCurDirInfo.GetDirectories(sDirPattern))
if (bVerboseMode || bTestMode)
Console.WriteLine( "Found " + obDirForDelete.FullName );
if (!bTestMode)
foreach(DirectoryInfo obLivingDir in obCurDirInfo.GetDirectories())
SeekAndDestroy( obLivingDir, alDirPatterns );
catch(Exception obExcep)
{ Console.WriteLine(obExcep); }

Playing with Mock Objects

We know that Agile Programming has arrived when the pointy haired boss has heard of it.

On a more techie note, I was reading through some papers for the second time. I am in the process of creating Mock Objects to help me automate my testing. It again reiterates my belief that the most beautiful things are generally the simplest. A good short introduction read would be http://www.pragmaticprogrammer.com/articles/may_02_mock.pdf from Dave and Andy (the PPs).
An even better paper is mentioned on my links list to the left.

Try F.E.A.R.

The next frontier in FPS. The ambience is great :))
As is the trend nowadays, the demo takes 1 Gig on my HDD and then gives me about 2 hours of gameplay before the Demo-n arrives and tells you to buy the whole game.
Impressed I am but upgrade your computer you must. (Yoda style)...
I have almost given up on PC Games.. I think each game now should now come with a GFX card with which the game works. Buying a console like a PS is a more enjoyable option.

Overcome F.E.A.R. you'll need to give it your best shot. http://www.whatisfear.com/us