The World’s Leading Microsoft .NET Magazine
   
 
timstall

Donate Today!

Search Box

 

Calendar

««Jul 2008»»
SMTWTFS
  
1
2
3
4
5
67
8
9
10
1112
13
14
15
16
17
18
19
202122
23
24
25
26
2728293031

My RSS Feeds








Mailing List

Most Popular Tags

                                                           

Five hours for one line of code

posted Thursday, 4 October 2007
The other day I spent five hours to write a single line of code. This has happened before, and it always makes me think "why?" To the non-developer it could sound crazy, I've heard many say things like: "it was just one line; you should be writing 100 line of code per hour to justify our budget."

 

The issues involved are:

  1. The developer is working on a legacy sub-system that they had never seen before (perhaps the original creators are no longer available, and you need to dig through their work)

  2. That sub-system is written in a different language

  3. The sub-system itself was complicated

  4. The line to be added was an undocumented feature

  5. It took very long to test each change

  6. This was a mission-critical feature, so it needed to work perfectly

You add those all together, and it's easy to see it the other way - "Wow, I'm glad we got that handled in only half a day".

 

Also, this is a rare case. A developer can write many lines of new code per day.

 

I think it touches on a bigger issue - just because the end result is simple doesn't mean that finding that result is simple too. For example, the total population for the US at a given moment is a specific number (somewhere around 300 million, off the top of my head). However, to find that exact number requires a huge bureaucracy and coordination among many civil organizations (like hospitals and immigration offices).

 

It something that any developer could come across, and should therefore be prepared to explain to their managers if needed.

 

tags:  

links: digg this    technorati    




1. Tim B left...
Thursday, 4 October 2007 9:28 am :: http://bigtunatim.wordpress.com

I think you meant to say there are 300 million people in the USA ;)


2. Tim Stall left...
Thursday, 4 October 2007 10:39 am

Oops, yes. I corrected it. Thanks.


3. Arthur left...
Sunday, 7 October 2007 2:59 pm :: http://www.chaparyan.com

Hopefully that one line wasn't a comment ;-)


4. Michael Sync left...
Sunday, 7 October 2007 8:43 pm :: http://michaelsync.net

>>Hopefully that one line wasn't a comment ;-)

haha. :) yeah..


5. Dave left...
Friday, 12 October 2007 8:14 am

So where is this famous line of code, then? C'mon, let's see it.


6. Pat left...
Sunday, 14 October 2007 5:02 pm

So how many lines of code did you write before settling on the one?


7. Tim Stall left...
Monday, 15 October 2007 8:43 am

It will sound silly, but this was the line:

<Property Id="ALLUSERS">1</Property>

I was trying to get an MSI package to install for all users instead of just the current user. We were using Wix (wix.sourceforge.net - an open source package to create Windows MSI installers). This line needed to be added to a template used to code-generate a wix file. The original devs who set up the process were gone. I had never touched wix before (although it looks really cool). The line was undocumented, but I was able to google it. To fully confirm I needed to run the entire build process, install with one user, and then uninstall with another. You get the idea.

About how many lines before this one? Maybe 10 different attempts. Because it was a configuration line (i.e. I was configuring an XML file instead of writing C# code), it was more research and less coding.