Refactoring katas with your own codebase

When it comes to refactoring, my preferred katas consist of experimentation with the actual code base I am working on. I just create a new branch from a certain commit, play with several refactorings and then throw it away. I usually end up with several experimental branches starting from the same commit. Sometimes if I end up with a better design, I apply the changes to the default or master branch, but that is not the goal. The goal is to improve my refactoring and design skills.

Pretty much every day, as I am coding, I find out slices of the code that smell. I find out room for a better design. However, if the code is working fine, I mean, if there are no known defects, if there is no real need to change, it's probably not worth spending work time to refactor it. At least not now. But I do write down a note about the smell to think about it later. This note often becomes the subject of the code kata.

When you approach your code base as a code kata, you don't have to care about time, you can just spend as much time as you want enjoying and learning. That code deals with a degree of complexity that is often hard to find in code katas. It's a real challenge. A big chance to improve your skills. The fact that I can experiment without any pressure, sometimes lead me to much better designs that the code base end up benefiting from. Eventually it's also good for my customers and colleagues.

Try it out and let me know whether you find it useful 😉

Enjoyed reading this post?
Subscribe to the RSS feed and have all new posts delivered straight to you.
  • Nikita Tchayka

    Really interseting post, I will try this for sure!

  • Pawel Duda

    What’s better than hitting your own wall and then looking for a solution? Perfect position for learning 🙂

  • http://www.carlosble.com/ Carlos Ble

    Hehe, I bet you have practiced this “kata style” several times mate!

  • http://www.carlosble.com/ Carlos Ble

    Cool, let me know how it works for you 😉

  • Pawel Duda

    Yeah, although I should do it more often. I also remember Avdi Grimm talking about using a similar approach for teaching. That is, letting somebody make mistakes and only then offering another way of doing things, which at that point, if applied successfully, is way more memorable.

  • http://www.carlosble.com/ Carlos Ble

    thank you for sharing mate 🙂