![Page 1: Transformation Priority Premise @Softwerkskammer MUC](https://reader031.vdocuments.us/reader031/viewer/2022030303/587b3ad21a28ab9c0e8b49d3/html5/thumbnails/1.jpg)
The Transformation
Priority Premise
Softwerkskammer Meetup Munich
11.02.2016
David Völkel
![Page 2: Transformation Priority Premise @Softwerkskammer MUC](https://reader031.vdocuments.us/reader031/viewer/2022030303/587b3ad21a28ab9c0e8b49d3/html5/thumbnails/2.jpg)
Agenda
● Pizza
● Theory
● Kata
● Another Beer
![Page 3: Transformation Priority Premise @Softwerkskammer MUC](https://reader031.vdocuments.us/reader031/viewer/2022030303/587b3ad21a28ab9c0e8b49d3/html5/thumbnails/3.jpg)
Problem
Stuck with TDD
Too much to implement in one test
Image by Thor
![Page 4: Transformation Priority Premise @Softwerkskammer MUC](https://reader031.vdocuments.us/reader031/viewer/2022030303/587b3ad21a28ab9c0e8b49d3/html5/thumbnails/4.jpg)
Solution
Take Baby Steps
Image by Seattle Municipal Archives
![Page 5: Transformation Priority Premise @Softwerkskammer MUC](https://reader031.vdocuments.us/reader031/viewer/2022030303/587b3ad21a28ab9c0e8b49d3/html5/thumbnails/5.jpg)
What to choose next?
Simple to Complex
● What is the most simple
implementation?
● Uncle Bob‘s guideline: the
„Transformation Priority Premise“
![Page 6: Transformation Priority Premise @Softwerkskammer MUC](https://reader031.vdocuments.us/reader031/viewer/2022030303/587b3ad21a28ab9c0e8b49d3/html5/thumbnails/6.jpg)
Test Driven Development
red
refactor
green
![Page 7: Transformation Priority Premise @Softwerkskammer MUC](https://reader031.vdocuments.us/reader031/viewer/2022030303/587b3ad21a28ab9c0e8b49d3/html5/thumbnails/7.jpg)
Types of Code
Testcode
red
refactor
green
„Transformation“
= Implementation
Refactoring
Design
![Page 8: Transformation Priority Premise @Softwerkskammer MUC](https://reader031.vdocuments.us/reader031/viewer/2022030303/587b3ad21a28ab9c0e8b49d3/html5/thumbnails/8.jpg)
Transformation Priorities
● ({}–>nil) no code at all -> code that returns nil
● (nil->constant)
● (constant->constant+) simple to a more complex constant
● (constant->scalar) replacing a constant with a variable
● (statement->statements) adding more unconditional
statements
● (unconditional->if) splitting the execution path
● (scalar->array)
● (array->container)
● (statement->recursion)
● (if->while)
● (expression->function)
● (variable->assignment) replacing the value of a variable.
![Page 9: Transformation Priority Premise @Softwerkskammer MUC](https://reader031.vdocuments.us/reader031/viewer/2022030303/587b3ad21a28ab9c0e8b49d3/html5/thumbnails/9.jpg)
Strategy
• When passing a test, prefer
higher priority
transformations
• Choose as next test the one
that can be implemented
with higher priority
transformations
green
refactor
red
![Page 10: Transformation Priority Premise @Softwerkskammer MUC](https://reader031.vdocuments.us/reader031/viewer/2022030303/587b3ad21a28ab9c0e8b49d3/html5/thumbnails/10.jpg)
Strategy
• When passing a test, prefer
higher priority
transformations
• Choose as next test the one
that can be implemented
with higher priority
transformations
• Even during refactoring
green
refactor
red
![Page 11: Transformation Priority Premise @Softwerkskammer MUC](https://reader031.vdocuments.us/reader031/viewer/2022030303/587b3ad21a28ab9c0e8b49d3/html5/thumbnails/11.jpg)
The Kata
Transformation priorities:
● ({}–>nil) no code at all -> code that returns nil
● (nil->constant)
● (constant->constant+) simple to a more complex constant
● (constant->scalar) replacing a constant with a variable
● (statement->statements) adding more unconditional
statements
● (unconditional->if) splitting the execution path
● (scalar->array)
● (array->container)
● (statement->recursion)
● (if->while)
● (expression->function)
● (variable->assignment) replacing the value of a variable.
http://agilekatas.co.uk/katas/RomanNumerals-Kata
![Page 12: Transformation Priority Premise @Softwerkskammer MUC](https://reader031.vdocuments.us/reader031/viewer/2022030303/587b3ad21a28ab9c0e8b49d3/html5/thumbnails/12.jpg)
Share your experience!
![Page 13: Transformation Priority Premise @Softwerkskammer MUC](https://reader031.vdocuments.us/reader031/viewer/2022030303/587b3ad21a28ab9c0e8b49d3/html5/thumbnails/13.jpg)
The Kata
Transformation priorities:
● ({}–>nil) no code at all -> code that returns nil
● (nil->constant)
● (constant->constant+) simple to a more complex constant
● (constant->scalar) replacing a constant with a variable
● (statement->statements) adding more unconditional
statements
● (unconditional->if) splitting the execution path
● (scalar->array)
● (array->container)
● (statement->recursion)
● (if->while)
● (expression->function)
● (variable->assignment) replacing the value of a variable.
http://agilekatas.co.uk/katas/RomanNumerals-Kata
![Page 14: Transformation Priority Premise @Softwerkskammer MUC](https://reader031.vdocuments.us/reader031/viewer/2022030303/587b3ad21a28ab9c0e8b49d3/html5/thumbnails/14.jpg)
Share your experience!
![Page 15: Transformation Priority Premise @Softwerkskammer MUC](https://reader031.vdocuments.us/reader031/viewer/2022030303/587b3ad21a28ab9c0e8b49d3/html5/thumbnails/15.jpg)
Benefits?
![Page 16: Transformation Priority Premise @Softwerkskammer MUC](https://reader031.vdocuments.us/reader031/viewer/2022030303/587b3ad21a28ab9c0e8b49d3/html5/thumbnails/16.jpg)
Benefits
Easier and more effective TDD ● Complexity based guideline for choosing
next test & implementation
● Reduces getting stuck with too big steps
● Less tests that are already green
● Less tests left out
![Page 17: Transformation Priority Premise @Softwerkskammer MUC](https://reader031.vdocuments.us/reader031/viewer/2022030303/587b3ad21a28ab9c0e8b49d3/html5/thumbnails/17.jpg)
Issues?
![Page 18: Transformation Priority Premise @Softwerkskammer MUC](https://reader031.vdocuments.us/reader031/viewer/2022030303/587b3ad21a28ab9c0e8b49d3/html5/thumbnails/18.jpg)
Issues
● Are there other transformations? (almost certainly)
● Are these the right transformations? (probably not)
● Are there better names for the transformations? (almost
certainly)
● Is there really a priority? (I think so, but it might be more
complicated than a simple ordinal sequence)
● If so, what is the principle behind that priority? (some
notion of “complexity”)
● Can it be quantified? (I have no idea)
● Is the priority order presented in this blog correct? (not
likely)
● The transformations as described are informal at best.
Can they be formalized? (That’s the holy grail!)
Raised by Uncle Bob
![Page 19: Transformation Priority Premise @Softwerkskammer MUC](https://reader031.vdocuments.us/reader031/viewer/2022030303/587b3ad21a28ab9c0e8b49d3/html5/thumbnails/19.jpg)
Retrospective
![Page 20: Transformation Priority Premise @Softwerkskammer MUC](https://reader031.vdocuments.us/reader031/viewer/2022030303/587b3ad21a28ab9c0e8b49d3/html5/thumbnails/20.jpg)
Special Thanks
to Ivan Kusalic
@ikusalic
for your inspiration
![Page 21: Transformation Priority Premise @Softwerkskammer MUC](https://reader031.vdocuments.us/reader031/viewer/2022030303/587b3ad21a28ab9c0e8b49d3/html5/thumbnails/21.jpg)
Images
THOR
https://commons.wikimedia.org/wiki/File:Parkour_leap_of_faith.j
pg?uselang=de
Seattle Municipal Archives
https://commons.wikimedia.org/wiki/File:Kids_at_Kubota_Garde
n_2003.jpg
![Page 22: Transformation Priority Premise @Softwerkskammer MUC](https://reader031.vdocuments.us/reader031/viewer/2022030303/587b3ad21a28ab9c0e8b49d3/html5/thumbnails/22.jpg)
Lizenz
Creative Commons Attribution-ShareAlike 3.0
https://creativecommons.org/licenses/by-sa/3.0/de/