SOLID exercises — Kata

By Karol Bocian | February 17, 2020

Today I practised SOLID by making Kata. I choosed very popular Kata: The String calculator. Do you know what Kata is?


Kata is a basic motion. It is a Japanese word, which describe specific motion sequence (fight moves). Regular Kata repetitions allow you to practice to perfection in your chosen technique. In programming, Kata describes sequence of tasks to do and be a better programmer. Kata is programming and solving the problem step by step, practicing for example TDD. The sequence is as follows:

  1. Read instruction (business requirement).
  2. Write a test, to check the code (confirmation of meeting business requirements).
  3. Write code, to pass the test (solution).
  4. Improve the code (refactoring).

SOLID reminder

SOLID principles are basic rules of object-oriented programming. You should not only know them but also practice and use them at work. At first, I remind you of SOLID principles, and then I show you some exercises.

Single responsibility principle

Every class should have only one responsibility (every class should have only one reason to change) — one purpose of existence.

Open/closed principle

All classes should be open for enlargement and closed for modifications.

Liskov substitution principle

The application should work correctly when we put in the base class place every derived class.

Interface segregation principle

Many small and dedicated interfaces are better than few and general.

Dependency inversion principle

High-level modules should not depend on low-level modules, but the dependence should result from abstraction.


Today I was practising SOLID with kata: I was using VisualStudio 2019, and running unit tests written in Microsoft.VisualStudio.TestTools.UnitTesting. To run unit tests, I was using shortcut: Ctrl+ R, A.

All posts from mini project: Learn SOLID and OOP principles:


Main image


Leave a Reply

Your email address will not be published. Required fields are marked *