views:

158

answers:

3

Duplicate:

What are Code Smells? What is the “best” way to correct them?

I was just curious about what kind of items cause developers to go "Oh, this code smells off", either language-specific or -agnostic. I know some that personally make me flare my nostrils are

  • Nested ifs (low readability, probably too complex);
  • Pointers (do you really need the extra hassle?);
  • Badly named methods.

Anyone else got additional dislikes, pet hates, or just items you have noticed have a definite correlation with code in need of refactoring?

+2  A: 

This is a dupe.

Peter J
+1  A: 
  • Functions that require more then two PageDowns to view
  • Multiple functions with almost the same names (and almost the same code layout)
Timur Fanshteyn
+1  A: 

Heavy occurrences of commented-out code in a production build-- either large commented-out blocks or seemingly-random commented lines of code. It suggests the developer didn't know what they were doing and just kept trying different things until it seemed to work. It also suggests a lack of familiarity with source-control systems, which is itself a big sign of trouble.

You mention pointers, but that's a language-specific detail. In many languages they're an unavoidable, inherent part of doing business.

Tom Harrington