Code Refactoring for the Win

Code refactoring is improving readability and reduces complexity.

Don’t waste time to write perfect codes. As a developer, writing clean code will come naturally. Many years ago, I hired a developer who loves writing perfect code. He spends weeks to refactor something that is already working and readable. Unfortunately, it’s not worth the money and time spent on it.

No developer can write perfect code. Don’t refactor because you are afraid of criticism from other developers. Learn how to be a better developer by learning from criticism, failure, and mistakes.

“When I talk about refactoring, I’m often asked about how it should be scheduled. Should we allocate two weeks every couple of months to refactoring? In almost all cases, I’m opposed to setting aside time for refactoring. In my view refactoring is not an activity you set aside time to do. Refactoring is something you do all the time in little bursts. You don’t decide to refactor, you refactor because you want to do something else, and refactoring helps you do that other thing.”
― Martin FowlerRefactoring: Improving the Design of Existing Code

Refactoring can break the working code. It’s very important to write test code before refactoring.

When is a good time to refactor?

Clean code matter and refactoring can improve code quality and productivity.

  1. Speed up development process without losing control
  2. Adding new feature
  3. Fixing bug
  4. It’s cheaper than rewriting

I am a fan of small refactoring to keep code clean and maintainable.




One thought on “Code Refactoring for the Win

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s