Test: 21
TPP: unconditional -> if (a new statement, number == 21), and the new execution path is a nil -> constant transformation
Test: 22, and renamed the test to "two digits until 29 convert to two words"
TPP: constant -> scala (1 -> number - 20). I'm not very sure since "number - 20" is actually a calculation. But, it's a simple minus calculation to get a constant.
Test: 30
TPP: unconditional -> if (number == 30), and the new execution path is a nil -> constant transformation
Let's ignore current order of TPP for now and think about a simpler way to pass case 30.
A simpler way I see here is to use Map instead of array so that 30 can be a part of Map and then the case can be passed. So, that's the refactoring happened that.
Another refactoring I did is that I changed the order of two execution path by reverse the if condition to "number <= 20".
Test: 30, passed it again with a new transformation
TPP: array -> container (WORDS array -> NUMBER_TO_ONE_WORD map). And, the if condition was changed to "NUMBER_TO_ONE_WORD.containsKey" which quite reasonable when applying this transformation
What does this transformation mean?
array -> container gets a simpler and better code than the original unconditional -> if transformation. So, does this mean array -> container should have a higher priority? I think so.