http://www.amazon.com/Refactoring-Patterns-Joshua-Kerievsky/...
I'd recommend these books, mixed with some searching around for best practices for whatever specific framework/language/toolkit you are writing code with.
Clean Code
http://www.amazon.com/Clean-Code-Handbook-Software-Craftsman...
Refactoring to Patterns
http://www.amazon.com/Refactoring-Patterns-Joshua-Kerievsky/...
If a piece of code survives long enough to deserve some refactoring, then i take a closer look at the patterns.