What are the signs you rely on, to know that you are looking at bad code?
Here are a few that i have constructed based on my experience on C and C++. If you do not know why these are bad, then you have bit of a thinking to do yourself. I shall try to find appropriate reading materials or horror stories or explanations for each of these and link them in, as and when i find the time to do so.
If you have more on your list do send them down and i shall update this list to include them.
- Return values ignored
- Uncaught Exceptions
- go to
- Global Variables
- User inputs not validated especially if pointers
- String lengths not validated for C style arrays
- Too many code warnings
- Plain dirty / non aligned code
- Junk / confusing variable names
- Deep levels of inheritance (more than 2?)
- Duplication (Did you know that there are tools to detect those?)
- Class / function too big
- Class / function does more than one thing
- Too many interdependencies
- Too many variables / member variables / parameters
- Bad class / function names – not representative of what it does or is too big
- Pointy code
- Code with lines too long that you have to browse to read the full line
- No comments