views:

566

answers:

21

We've all done them, the short fix that will get the system back up and running until we can Do The Right Thing.

What have you marked in your code with the dreaded //Hack comment?

+6  A: 

Any kind of hard-coding.

Guy Starbuck
+24  A: 

Ctrl+C, Ctrl+V

mattlant
I call this the Clipboard Board Factory pattern.
Chris Noe
+22  A: 

When I make a minor change and it works, but I'm not really sure why.

JosephStyons
These ones always make me nervous!
ConroyP
Oh God yes. I get a very sick feeling when this happens. And you know you can't just change it back, it works now. And all you can do is hope to goodness the new fix doesn't break 'cause you have no idea what you'll do to "fix" it again. ::shudder::
Dinah
i always have an idea how to fix a certain problem, its just, this idea is permanently changing ...
Chris
+8  A: 

Throwing DLLs into the same directory as the executable so that they can be found.

John at CashCommons
+1  A: 

Changing the timezone instead of fixing the timestamp problems.

docgnome
+1  A: 

Commenting out the line that is causing a segfault.

Josh Matthews
+2  A: 

replacing a faulty peice of code with an if / else

Jurassic_C
+1  A: 

Coding something without proper exception and argument handling.

  • i.e. Not checking for null or empty variables.
  • Opening a connection (which could fail) and then running methods on that.
  • Selecting from a list of elements (which may not return anything) and doing logic on the first element (which may not be there since the list could be empty).
nyxtom
A: 

When using a truly Object Oriented language, typically anything that requires an if statement, or especially a switch. It's usually a sign that you're not doing OO correctly.

Steve
you don't always want to use OO
grom
You care to elaborate?
Jorge Israel Peña
Switch statement which is an O(1) jump to a hash vs a type comparison or Vtable lookup can affect performance in certain areas...
Spence
+4  A: 

Writing my own function rather than taking the time to figure out how to use somebody else's pre-existing, tested, and proven function.

Writing code is easier than reading it.

Steve
A: 

Table based HTML design when x-browser issues made me realise my CSS skills need more work

Jon P
This used to make me feel sick until I reasoned that, like tables, a million div tags is not separating my content from layout. The layout doesn't work until I have just the right HTML voodoo first. So I'm just as happy with tables if I can't get CSS working in a reasonable amount of time.
Dinah
@Dinah I do aggre there is no point replaceing a table layout with divs if you're going to end up with more div tags than table related tags!
Jon P
+4  A: 

Using the windows registry as a communications channel between different parts of the same software system, because it's so much easier than doing it correctly.

Jim In Texas
That is scary. :)
George Edison
+1  A: 

My fellow workers have this ritual ( not exactly but some sort of )

Copy resource files all over the computer for the program to find them.

Shutdown the app.

Shutdown the IDE

Shutdown the messenger ( just in case )

Shutdown all the applications ( to make it sure )

Shutdown the whole computer ( not restarting it but actually shut down and leave it for exactly 2 minutes )

Jump three times on one foot.

Turn the lucky cup up side down 1 time

and walk around the block clockwise ( otherwise It won't work ) .... .

Ahh and give a little pray.

When they do this, it makes me so angry. I tell them there is not such a thing like Voodoo programming.

But.. when I'm all alone, at 3 a.m. on a holiday ( like .. Independence Day or some other ) I ask myself... what if I do the ritual....

OscarRyz
Hey, what have you got to lose?
KevDog
@KevDog: Your immortal soul? ;-)
Steve S
+2  A: 

This just never works..

public static void sanityCheck () throws ScaryException {
  // TODO
}

also, putting in all initialization values at the beginning of the program, with a "this will go into a config file" comment. Should just put it in the config file.. it'll take 5 minutes! And yet, I start off this way every time.

SquareCog
+3  A: 

Any bug fix that's committed without a non-regression test...

Xavier Nodet
+9  A: 

"Find/Replace All."

Even scarier when it works.

Evan Hanson
When I read this answer and felt my stomach lurch with thoughts of the last time I did the same, I immediately gave it a +1
Dinah
Actually very safe and useful if you are converting a program from tabs to spaces. (not the other way around though)
PiPeep
+3  A: 

Code that is dependent on the date because of changes in other systems. Code like, "after 2008-10-xx, remove this check".

Adam Neal
+7  A: 

Adding null checks where null should not be possible, but not figuring out how a null ended up there. (But I never leave the code like that!)

Chris Pine
+3  A: 

If nothing explodes when I build after an hour of code-editing, I get suspicious.

FreshCode
A: 

I have a friend who is a SQL ninja who will occasionally give me some slick solution. I can follow what's being done but I know that if it needs to be tweaked, I will be ill-prepared to do so. This doesn't prevent me from using the SQL but it does fill me with queasiness.

Dinah
A: 

After a while of debugging a lot of errors, I'll run tests to see how many errors are left. If it goes from being a lot of errors pre-debugging to zero errors after, I feel great for a millisecond, then I wonder sickly if I broke the tests themselves.

Dinah