Taking over bad code, a question and some name dropping :-)

03 Nov
by mjeaton, posted in Uncategorized   |  4 Comments

If you took over an in-progress project from another developer, would you take his word for it that “it’s 99% complete” or would you want to verify it against the specification?

I recently took over a project from another developer.  After looking at the horribly written code, I asked the client for the spec so I could verify that the code was actually doing what the client wanted.  The client wasn’t quite sure what I was asking for, so he emailed the original developer.

BTW, this is what I was presented with when I first loaded the solution into Visual Studio.  I removed any identifying text from the screenshot. :-)

SolutionExplorer

The developer (we’ll call him Jim) replied back to the client essentially telling the client how stupid I was.  In the spirit of full disclosure, Jim and I both worked as Project Directors (tech leads) at the same consulting company in 2000-2001.  Professionally we got along most of the time, but we definitely had our differences and butted heads several times.

Here is a quote from the email he sent to the client:

It sounds like Mike is getting lost in the way the app was implemented.

It could be that he just isn’t familiar with dotnet 2.0 and master pages. If that is the case, the architecture and framework I used may not be what he expected. I tried to pepper my code with lots of comments about how/why I did it the way I did. If he has some more specific questions, other than [where is the spec], I could explain parts of it so he could get over the framework and just work on the app logic.

Huh?  My request for some kind of specification means that I’m dumb and don’t understand .NET development?  Wow.  WTF-ever.  My initial reaction was outright anger, but strangely enough, that changed to having doubts about my own skills.  Maybe the code wasn’t that bad.  Maybe I really didn’t “get it”.  Maybe the code was “perfect”. ;-)

I had to know, so after consulting with some friends and colleagues (name drop time!) like Dave, Jayme, James, Will, Dan and Mike (non-blogging loser :-p) I calmed down and realized that no, it wasn’t me and yes the code really did suck. :-)  

The code itself is a great example of copy-and-paste development.  Each of the pages you see in the screenshot above is one step of a Wizard.  Each of the code-behind files is almost identical with gems like:

If (Not Request.Form(“ctl00$btnNext”) Is Nothing) AndAlso Request.Form(“ctl00$btnNext”) = “Next” Then

    btnNext_Click(sender, e)

ElseIf (Not Request.Form(“ctl00$btnPrev”) Is Nothing) AndAlso Request.Form(“ctl00$btnPrev”) = “Prev” Then

    btnPrev_Click(sender, e)

End If

That just feels dirty. :-)

BTW, another quote from his email:

The funny thing is that the app is 99% done and just needs a few bug fixes.

Oh, did I mention that the 1% includes the fact that the damn app doesn’t write to the database?  Nice.

BTW, after talking to the client, it turns out there is no specification.  There’s not really even any emails back-and-forth between the client and Jim.  It was based primarily on conversations.  The client and I walked through the screens yesterday and they appear to be what the client wants with a few minor exceptions.

After looking at the code though, I’m not comfortable with taking it as-is and trying to support it.  My recommendation to the client will be this:

  • I’ll use what he has a base, mainly for the user interface
  • I’ll re-write the code and bring it in-line with another web app I’m doing for them for consistency.
  • I’ll document

Did I mention that Jim and this guy know each other. :-\

Ok, this post started with a simple question: If you took over an in-progress project from another developer, would you take his word for it that “it’s 99% complete” or would you want to verify it against the specification?  Any thoughts?

4 Responses to Taking over bad code, a question and some name dropping :-)

  1. Scott

    at…least…the pages look…to be ordered?

    is it bad that I thought “oh that’s a wizard” before I read further wher eyou say it is?

    NEVER take the word of someone else, no matter how well you know them, on a project that you will be held responsible for.

  2. Michael Eaton

    You know…back in the Classic ASP days, I’d except to see the kind of code he wrote, but damn…not in 2007 using ASP.NET 2.0/VS 2005. It’s just not right. :-)

  3. Chris

    How does he know it’s 99% done if he has nothing to go against?

  4. Michael Eaton

    Because he’s obviously much smarter than me and must have been trained by your boss. :-)