Bug Density

<Adam> pickle.dump((self.dsId, dict((key, self.index[key].tolist()) for key in self.index)), open(path, ‘w’))
<Adam> Wow. Just when I was beginning to think that Guido’s plan to use structure-as-syntax was going to force nice readable structure on everyone, my hopes are dashed.
<meekay> People are still writing sh_tty code.
<Adam> And I deal with it!
<dman> That’s python?
<dman> I thought the whole point of Python was to make code like that impossible.
<Adam> Well, it’s the traditional “one in n lines of code contains a bug, so I’m going to reduce the number of lines in order to keep bugs out” thinking.
<Adam> Ironically, the kid who wrote that is my coworker who apparently had an offer from google and turned it down last year.
<meekay> I actually espouse that belief.
<meekay> Of course, if you get to the point where you’re writing obfuscated Perl in Java, you’re being counter-productive.
<Adam> I think, however, that a distinction needs to be made between “one in n operations contains a bug” and “one in n lines of code”.
<Adam> Packing more operations into one line just means that you’re making the bugs harder to untangle.
<Adam> And the code harder to parse for my poor little brain.
* Adam dumbass. Likes to stay that way.
<meekay> The pattern is not typically x bugs per n lines of code across the industry.
<meekay> It is typically a solid average x bugs per n lines of code per developer.
<meekay> And some developers have a lower x than others.
<dman> Adam: Greater bug density!
<meekay> I, for example, try to keep x very low.
<meekay> And by doing so, I am more productive.
<meekay> Because my coworkers bug queues typically have size five or six, and I typically have size two.
<dman> I think if the operation is a no-brainer, that stuff is okay, but you should reuse one of the lines you “saved” to drop a comment that will give the next sucker who has to maintain your code a friggin clue.
<meekay> Where “the next sucker” may in fact be you.
<meekay> =)
<meekay> I love it when my coworkers come and ask me about code that they wrote.
<dman> especially me, because i’m the SysAdmin, and when I start looking at the code, we’re already in trouble.

Read More

Categories: Technical

Discover more from dannyman.toldme.com

Subscribe now to keep reading and get access to the full archive.

Continue reading