Record of experiments, readings, links, videos and other things that I find on the long road.
Registro de experimentos, lecturas, links, vídeos y otras cosas que voy encontrando en el largo camino.
Sunday, April 7, 2019
Interesting Talk: "In Search of Doors"
The Beverages Prices Refactoring kata: a kata to practice refactoring away from an awful application of inheritance.
I created the Beverages Prices Refactoring kata for the Deliberate Practice Program I’m running at Lifull Connect offices in Barcelona (previously Trovit). Its goal is to practice refactoring away from a bad usage of inheritance.
The code computes the price of the different beverages that are sold in a coffe house. There are some supplements that can be added to those beverages. Each supplement increases the price a bit. Not all combinations of drinks and supplements are possible.
Just having a quick look at the tests of the initial code would give you an idea of the kind of problems it might have:
If that’s not enough have a look at its inheritance hierarchy:
To make things worse, we are asked to add an optional cinnamon supplement that costs 0.05€ to all our existing catalog of beverages. We think we should refactor this code a bit before introducing the new feature.
We hope you have fun practicing refactoring with this kata.
Thursday, April 4, 2019
Books I read (January - March 2019)
- Timeless Laws of Software Development, Jerry Fitzpatrick
- Writing to Learn, William Zinsser
- The End of the Affair, Graham Greene
- Beyond Legacy Code: Nine Practices to Extend the Life (and Value) of Your Software, David Scott Bernstein
February
- Refactoring Workbook, William C. Wake
- Binti, Nnedi Okorafor
March
- Home, Nnedi Okorafor
- The Night Masquerade, Nnedi Okorafor
- Developer Hegemony, Erik Dietrich
- The Ministry of Utmost Happiness, Arundhati Roy