Is it immoral to write crappy code even if readability and correctness is not a requirement?
Posted
by mafutrct
on Stack Overflow
See other posts from Stack Overflow
or by mafutrct
Published on 2010-06-16T14:24:54Z
Indexed on
2010/06/16
14:32 UTC
Read the original article
Hit count: 359
There are cases when crappy (i.e. unreadable and buggy) code is not much of a problem.
For instance, imagine you need to generate a big text file that mostly follows a simple pattern with a few very complex exceptions. What do you do? You quickly write a simple algorithm and insert the exceptional bits in the output manually to save 4 hours. The code is unreadable, and the output is flawed, but it's still the correct way since it is way faster.
But let's get this straight: I hate bad code. I've had to read and work with code that caused my stomach to hurt. I care a lot about good code.
And actually, I caught myself thinking that it is immoral to write bad code even though the dirty approach is sometimes superior. I was surprised by myself and found my idea to be very irrational.
Did you ever experience this? Should I just get rid of this stupid idea and use the most efficient approach to coding?
© Stack Overflow or respective owner