Get started with code cleanup

Nov 17, 2020


1. Pick a feature to implement and see which part of code will it deal with. The best time to cleanup a piece of code is when you are adding a feature to that part of the code.

2. Break the code into smaller methods, rename variables to more meaningful names.

3. Is there duplication? Can we extract a common method to remove duplication of logic?

4. Simplify complex conditional statements, break loops into smaller ones.

5. Look for one of these three problems —

  • One class is calling another for everything: The logic needs to be in that class.
  • Too much code in one class: There might be scope for a new domain object.
  • Complex if conditions: Could possibly be solved with polymorphism.

If you liked this article, please share it on social media.

View my courses on Udemy —
Subscribe to us on Linkedin —
View all our Youtube Videos —
Join our Facebook Group —

Subscribe to us on Youtube for an awesome video every Wednesday!