Ski Lift Pass Pricing Refactoring Kata

Ski Lift Pass Pricing Refactoring  Kata

In Austria there is a famous song by Wolfgang Ambros which goes like this “Skiiiiiiifoan, Skiiiiiifoan, Skifoan ist das leiwandste, was ma si nur vorstö’n kann”  (“skiing is the greatest thing you can think of”). That’s true, skiing is a really great hobby and sport, but well, the environmental impact is quite bad. But there’s something which is nearly as bad: the source code of this ancient piece of software that you have to take care of now. It basically calculates the price of a ski lift pass. Doesn’t sound too complicated? Well, we will see! And guess what: when the software doesn’t work, nobody can buy ski lift passes and the winter season in Austria is ruined. And your new boss Toni Polster will be mad at you (yes, he earns his money with software nowadays) .

The “Lift Pass Pricing Kata” is a Refactoring Kata originally by Johan Martinsson which has been ported and adapted to ABAP by Dominik Panzer. The goal of the Kata is to understand the pricing algorithm, refactor it und make the solution unit testable. No easy task because there are several obstacles in your way.

There are three classes – with each one the refactoring will become more and more complicated. So if you or your students are new to refactoring, start with the easiest class and try the more complex classes later.

Things that may help you

  • Rename – give variables a meaningful name
  • Delete unused variables – they are in your way
  • Delete useless comments and old code – they are just noise
  • Restructure conditionals – they look complicated, don’t they?
  • Replace magic strings and numbers with constants – now everybody knows what you mean
  • Extract method – less code to understand
  • Get rid of dependencies – so you can fake them

Have Fun!

Github

You can find the kata here:

Lift Pass Pricing Kata ABAP
https://github.com/dominikpanzer/ABAP-Lift-Pass-Pricing-Kata
2 forks.
4 stars.
1 open issues.

Recent commits:

ennoadm

Verwandte Beiträge

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert

Read also x