09-11-06 - 1

I think I've gotten back to "smart hacking" in coding. I had a bug in my poker helper that it would weirdly set the bet value repeatedly. I tried to debug for a second and then just said screw it - when I set the bet value I flip a bool and don't do it again until action comes back to you, problem solved. There may be a real bug lurking, but who cares, this is 100x faster. Now, if this were mission-critical software I wouldn't want to do that, and back when I was a lead I never wanted to let this kind of hack bug fixing in, though I would sometimes. It is a good idea to forbid this in your core systems, something like a rasterizer or a thread switcher, you want to really be sure that your routines are doing exactly what they claim to be doing. However, in leaf/functionality code it's perfectly okay to patch over some functionality or hack over a bug. Obviously in big code bases those hacks can spread and you have to be vigilant about that as well, but that doesn't mean you should never make use of the hack.

It is by will alone I place a hack in my code.
It is by refactoring that the code is kept clean,
  the cleanliness ensures maintainability, the maintainability provides stability.
It is by will alone I place a hack in my code.

No comments:

old rants