LATELY — 16 March 2006

Agony Aunt

Is there an agony aunt for com­puter programmers? Goddamn. I’m doing some work at the moment with this guy who writes really shitty PHP code. (I do gen­uinely like him, and we get along fine, but his code gives me the willies.) It does work–for the most part–but it’s point­lessly (and frustratingly) obfuscated. For example: today I came across a $comment vari­able that has ab­solutely nothing to do with comments--it was copy and pasted from some other code that did involve com­ments and I guess he figured he didn't need to change it. Oh, and the un­doc­u­mented "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 un­doc­u­mented and in­com­pre­hen­si­ble nested for loops and funky array index arith­metic which turned out to do the equiv­a­lent 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 ac­tu­ally ig­no­rant 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 func­tions with “what does this do??” and make cryptic remarks about his code. I don’t like being like this! What do I do?