16 March 2006
Is there an agony aunt for computer programmers? Goddamn. I’m doing some work at the moment with this guy who writes really shitty PHP code. (I do genuinely like him, and we get along fine, but his code gives me the willies.) It does work–for the most part–but it’s pointlessly (and frustratingly) obfuscated. For example: today I came across a
$comment variable that has absolutely nothing to do with comments–it was copy and pasted from some other code that did involve comments and I guess he figured he didn’t need to change it. Oh, and the undocumented “random_loop” function. This was great: not only did it turn out to have nothing to do with loops, but the code was about ten lines of undocumented and incomprehensible nested for loops and funky array index arithmetic which turned out to do the equivalent of
shuffle(range($n, $m)) (well, except that shuffle doesn’t return anything, but you get the idea). So in sum we have: poor name, no documentation, poor implementation–complete waste of a function!
I don’t know how to deal with this! Do I get him to change? Or do I chill more? He’s not actually ignorant of the right thing to do–mostly it just doesn’t bother him very much, I think. What happens at the moment, though, is get all passive-aggressive and do things like “document” his functions with “what does this do??” and make cryptic remarks about his code. I don’t like being like this! What do I do?