Intermediate Refactoring katas

Our recommendation is that you first go through Object-Oriented Programming katas so that you can move on to more complex testing concepts. If so, we can start with the application of the refactoring techniques presented below. 

Below you will find a list of kata with a certain level of difficulty and a link that will take you to a detailed explanation and the solved exercise.

You will find an introductory context for each kata and then the details you need to be able to perform it. And remember: the best way to learn and improve is to practice. Let's start!

Tennis kata: Imagine you are doing a Code review and you have to identify the code smells and what would be their correct abstractions. Review an introduction and explanation of the Tennis kata in the author's own voice.
Iteration 1: Level 1
Iteration 2: Level 2: Abstracts the concepts into objects that encapsulate the logic of the kata.
Iteration 3: Level 3: Reverses changes when a test fails.

Import-user-kata
Iteration 1: Create a setup to test your kata, identify the code smells, and create a test [Golden master]. The goal is the setup, not to solve the kata.
Iteration 2: With the previously created tests, solve the kata.

Gilded Rose: Working with legacy code.
Iteration 1: You don't have to do the tests, use the ones the kata has by default.
Iteration 2: Applying Object Calisthenic.
Iteration 3: Start working on Characterisation Tests.
Iteration 4: Apply changes in parallel.

Beverages Prices kata: Refactor a kata with painful inheritance
Iteration 1: Use parallel changes.

Parrot Refactoring Kata
Iteration 1: Identify the codesmell and try to resolve them.
Iteration 2: Refactoring with Object calisthenic.

Smelly Mars Rover: Kata designed to refactor the code smells we see and apply Parallel changes.
Iteration 1: IIdentify the smells and refactor in order of importance according to your point of view.
Iteration 2: Applying Object Calisthenic.
Iteration 3: Use parallel changes. Use Inheritance to move logic where the code takes you (the code speaks to you).

When you finish, watch how others have solved this kata and finally apply the changes yourself (not by following the video, that would be cheating yourself).


Smelly Tic Tac Toe: Reinforcement Kata if you want to work on a known domain.

Parallel Change Kata: Learn how to refactor without breaking any tests or compilation errors.

BugZero kata: Fix all bugs and cover them with tests.

Racing Car Katas:  Kata to work SOLID. The idea is to learn which SOLID principle is not being fulfilled and how to solve it.
Iteration 1: TirePressureMonitoringSystem exercise
Iteration 2: UnicodeFileToHtmlTextConverter exercise
Iteration 3: TicketDispenser exercise
Iteration 4: TelemetrySystem exercise
Iteration 5: Leaderboard exercise

TripService: Work on shallow branches (cover test code and then refactor changes).
Apply the stitching technique.
Work with legacy code by first adding coverage with tests that gradually solve the use cases you understand.
Understand why Singleton can do a lot of damage to your testability.

Refactoring Kata Lift Pass Pricing
Iteration 1: Broaden the test coverage, using characterisation tests and prepare your testing strategy consciously and working on the test pyramid.
Iteration 2: Evolve the application architecture to a hexagonal architecture.

Recommendations

  • Identify the different taxonomies of code smells.
  • Get comfortable with change </aside>.

Learnings

  • Identify the types of smells.
  • What are the most common refactors.
  • Making changes in parallel.
  • Techniques for working with legacy code.
  • Characterisation Tests.
  • Seam.
  • Preparing the environment to work with legacy code.
  • Using coverage.
  • Getting comfortable with legacy code.
  • Parallel changes.
     
Tell us about your challenges by clicking on the banner