This is a repost with little modifications of a post originally in my blog.
If you don't want to read the post, you can also watch the video version of it :
The sentence “if the code works, don’t fix it” is sometimes taken as a rule by newbie developers. Though most of the times it works, i Personally think it is just an excuse from lazy developers.
What is even a bigger problem are people who learn frameworks without learning the basic concepts which causes them to write spaghetti code, and when they see this "Rule" they think it's something everyone does.
- Becomes more readable by other
- Improve the code
- having testable
- having extensible code
- New To The Job
- Not Experienced Enough With The Technology
- A Part Of the Code That Won't Change Over Time
- Usage Of Open/Close Principle ( Add New Features Without Removing The old Ones )
- Read The Code Multiple Times Until You Understand It ( We All Know that our old code can only be understood by GOD but still give it a try )
- Separate Logic From State / UI Management
- Use Design Pattern To Turn The Logic Into Small Testable and Extensible Pieces.