You ever inherited a site done by someone else, and looked and the site and thought “what the hell where they smoking when they did that, and who gave it to the client making it seem like a good idea”? C’mon you web-snobs, I know you have. We’ve all done it. Heck, I’ve done it recently.
There are two sides to every story
Well, I’m going to stop making any judgments about the quality of other people’s work unless I know the circumstances around how it got developed. A day of reflecting on my own work has made me rethink things. Yesterday I was working on a project, plugging away and I thought “hey, I’ve solved this problem before, let me go see what I did”. So I pull out some old code, and next thing I know, I’m looking over some work I did some time ago. I wasn’t super impressed. I found a series of nested if statements at one point, when really it could have been written in one line. Is that the end of the world? No, but it shows inelegance, and a lack of careful planning. If this was someone elses work I would have thought “phfft, they’re lazy”. Anyhow, I was disappointed, so I thought I’d fix it up and upload it for my (former) client….
And then it all came flooding back.
- “Now, who was that client again….? oh yeah… them”
- “I had that working perfectly and then they changed the specs”
- “Golly, another new head of the committee… welcome to the team”
- “I remember that line of code… they actually threatened that if I didn’t have that working by the end of the day I wouldn’t get paid.”
- “But I’ve already changed that to behave the exact opposite way you want, after you asked me to, after you told me to change it back”
- “Design by committee is horrible, but design by committee when 3 of the 4 people who were spearheading the committee have quit or ‘moved on’ is death”
So as you can see… in a lot of the cases the slightly less elegant code was a result of a changing landscape. I don’t think I could possibly build to quality, when the idea of “quality” is a moving target. In that case, a nested if just worked for me. When you’re bound by the triple constraints of cost, quality and speed, then something has to bend. If the client isn’t willing to sacrifice cost or speed, then quality is going to suffer.
So I’m no longer going to look at
$some_dudes_name = 'some name';
echo "The name of that guy was " . $some_dudes_name;
and think “why did they even bother”? Maybe the developer was dumb (that’s always a possibility), or maybe that variable used to hold other information, or maybe they were directed that way, or maybe the dev inherited other code that the client wasn’t willing to let them alter it. Who knows?
Until I know the history and politics around why something was coded the way it was coded… I’m reserving judgment on anyone else’s work.
Oh yeah, and that inelegant client code I found? I never did fix it up.