Fog Creek Software
Discussion Board




Hacks are good for you!

Comments here on the MS code.
http://www.kuro5hin.org/story/2004/2/15/71552/7795

I partcilarly like (and agree with!) this statement:
"Comments like "UGLY TERRIBLE HACK" tend to indicate good code rather than bad: in bad code ugly terrible hacks are considered par for the course. "

Stephen Jones
Saturday, March 27, 2004

Agreed.  It all goes with the attitude of 'I am a really bad programmer, hence I am good'

Simon Lucy
Saturday, March 27, 2004

It depends on the code that the comment is describing.  I've seen a comment like that in a function that translates a date in one format to another.  The formats were both based on the number of seconds since date X, but with different values of X.  Instead of just basing the translation on X[0] - X[1], the calculation involved some bizarre accounting of leap years and leap seconds (and actually it was incorrect).  Worse yet, the code was copy/pasted all over the place.

Part of good programming is having the courtesy to correctly implement a necessary hack and get it out of the way so that nobody else has to care about it (but documenting the idea behind it in case somebody actually needs to know it).

K
Saturday, March 27, 2004

Most of the acknowledged "hacks" are to fix errors in applications including those written by other companies. They are really gracious accommodations of the work of people who didn't follow the API.

JM
Saturday, March 27, 2004

Great find. Interesting read.

Mr Jack
Monday, March 29, 2004

Not only that but later on you can search for the word "hack" to find things you might want to refactor. 

name withheld out of cowardice
Monday, March 29, 2004

*  Recent Topics

*  Fog Creek Home