Let's refactor (OOP style)

Theatrical players refactoring Kata in Object Oriented Programming

Start by establishing our plan

We can use the mikado methodarrow-up-right to do so.

Here is mine :

1) Extract the amount calculation

Create the interface

Extract the 2 implementations

Create a factory to retrieve the implementation based on the type

2) Extract the credits calculation

3) Create a specific Printer implementation

Create types (simple POJOs) that represents a Statement

Create a Printer interface

Extract the current print logic in a TextPrinter class

4) Putting whole together

Our code is now ready to be extended with the new HTLM printer.

Last updated