Logic Errors
This is part 7 of a 7-part series comparing different kinds of software bugs.
What is a Logic Error?
A logic error is a piece of code that executes properly but does not behave the way you intended.
Causes of Logic Errors
- Inexperience
- Sleep deprivation
- Distracted programming
- Texting and coding
- Developing Under the Influence (of Alcohol, Drugs, or Tryptophan)
- Ned from Accounting (stop calling me about my expense report, I'm trying to concentrate over here)
Consequences of Logic Errors
Logic errors are the worst kind of errors because they can go unnoticed for so long.
Some logic errors are obvious. The electrician wires up the lights in your new house. Everything is to code. Everything is perfectly safe. But when you flip the switch in the kitchen, the lights go on in the living room. That's a logic error, but it's one that's hard to miss.
Some logic errors are not obvious. They're like the black mold growing behind the walls of your finished basement because the vapor barrier got installed backwards. You don't even know it's a problem. Heck, it might not even [cough] be a problem. I mean [cough], how would you even [cough] know if you have [cough] black mold in your base–[cough]...[hack]...[hack]...[cough]–basement?
Referenced articles
Image by InspiredImages from Pixabay