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.

  1. Return values ignored
  2. Uncaught Exceptions
  3. go to
  4. Global Variables
  5. User inputs not validated especially if pointers
  6. String lengths not validated for C style arrays
  7. Too many code warnings
  8. Plain dirty / non aligned code
  9. Junk / confusing variable names
  10. Deep levels of inheritance (more than 2?)
  11. Duplication (Did you know that there are tools to detect those?)
  12. Class / function too big
  13. Class / function does more than one thing
  14. Too many interdependencies
  15. Too many variables / member variables / parameters
  16. Bad class / function names – not representative of what it does or is too big
  17. Pointy code
  18. Code with lines too long that you have to browse to read the full line
  19. No comments
Advertisements