TDD LCD Kata - Part 7
We refactored last episode, so we can do a new test!
I'm lazy, 23 reflects that.
Time to hack away and get 23 working! Largely based off of the code for 10. Make it work, then refactor it.
With our modifications to the copied "10" code; it passes. Quickly.
We recognize that there's a pattern, how do we extract that?
How can we effectively perform the similarities for all numbers?
New thoughts, while coding... Interesting thoughts... Hmmmm....
Small changes and make sure we still pass - YEAH!
With the patterns we recognize, we refactor. Keep refactoring. As long as the tests pass, we're free to refactor.
Refactoring exposes more patterns. Often smaller and easier to see once some refactorings are there.
Sometimes seeing a pattern doesn't give us a good generalization. Leave it. Wait until you don't need to force it.
Write a new test to help expose what might be generalized.
Recognize that I'm still writing out the expected values. No Copy/Paste. I'm ensuring I pay attention to what it is expected to be.
Once we have functionality we can use, we use it. We have the adder method, we use that to get 789 passing quickly.
The pattern shows itself!!! ... For next time.