Mastering refactoring in Kotlin

A playground to master the art of refactoring

Nicola Gallazzi
6 min readFeb 7, 2022

What’s refactoring?

A change made to the internal structure of software to make it easier to understand and cheaper to modify, without changing its observable behaviour

In our developer's life, we are often overwhelmed by days passed implementing lots of features, sometimes shipped too fast to please some product manager or stakeholder, without any care for code quality. But what about us reading our own work after some time? How can we make the code readable and easy to understand for us and for those who didn’t write the code in the first place?

Writing hieroglyphics — ©mypandasuit

There are probably thousands of reasons why we should put refactoring best practices in our daily habits, but I tried to sum up my favorites in the following list.

Why refactoring?

  • Make code easier to understand, close the gap between what I want to do and what I tell
  • Reduce the amount of code to read and understand
  • Make easier to spot bugs
  • Develop faster and with a continuous improving design

When refactoring?

--

--

Nicola Gallazzi

Android Developer with a true passion for clean code. In love with Kotlin. Former Udacity mentor and code reviewer