I came across an article today on Quora where a developer was asking, "What are some bad smells in programming". If you don't frequent Quora, you should...
Quora Software Engineering
Quora Computer Programming
It's one of those Quora questions that elicits very intelligent responses and generates good discussion. It's a brilliant way to ask the question too. Can software smell? It sure can stink sometimes. The discussion led to one poster including this link from sourcemaking.com, https://sourcemaking.com/refactoring/smells, which is a very good primer on code refactoring.
Face it. Most of software development is refactoring. If you aren't refactoring constantly as you develop, then you aren't developing a more concise and clear understanding of the business problem. No matter how many meeting you have been through, or how many games of Planning Poker you have played, when you open up the IDE for the first time you only have a rudimentary understanding of how the system is to come together. The more pieces you build, the better you understand how to build other pieces and how they should fit together. As that understanding begins to gel, you will ALWAYS need to go back to clean up and redesign the pieces you wrote earlier.
Refactoring is an indication that you are getting better at your craft, NOT an indication that you sucked at it yesterday.
So Refactor My Friend!