Code Refactoring

Refactoring is the process of editing code to reduce or eliminate technical debt. Refactoring is generally a correction to reduce code smells. The end goal of refactoring is to take inelegant and poorly designed code and change it into clear, understandable, and maintainable code.

What are the best practices for refactoring?

  • Developers should not couple refactoring new development but rather perform it as a separate activity.
  • The resulting code should be cleaner, more readable, maintainable, and less ‘smelly’ than before.
  • Tackle code smells one at a time. Code smells are symptoms, so dive deep and fix the underlying causes rather than just covering up the smell.
  • If the code contains test suites, all tests must pass after refactoring. If tests fail due to a new bug, undo the change. If they fail on account of being poorly designed, update the tests.

Automate objective parts of code reviews

Automate objective parts of code reviews

Get started