"PascalTriangleAnimated2"
by Hersfold
in Public Domain
The goal of this kata is to generate a string version of Pascal's Triangle up to a given line. It's a nice problem to practice a mix of top-down and bottom-up styles.
Bottom-up style is when you build a brick outside your main acceptance test flow and only later integrate it with the rest of the program. On the contrary, Top-down style is when you only work on the code that is covered by the acceptance or high level tests.
In order to experiment full bottom-up style start the kata with 10 minutes of up-front design and come up with the different 'bricks' you will need to solve the problem. Then use the bottom-up way to solve the kata:
- Write an acceptance test, and comment it
- Test drive the implementation of each brick
- Using all the bricks, test drive the implementation of the main function
- Uncomment and pass your acceptance test
Note: Bottom-up / Top-down are also known as Inside-out / Outside-in
- It lets you work in small steps
- It tends to result in more reusable and robust bricks
- There is a risk that the brick does not integrate well with the main code, leading to a lot of rework. Then a good recommendation is to integrate the brick as soon as possible in the main code.
- Creating a robust brick is often more work than necessary for the current acceptance test
You can fill it from here
- Wikipedia page on Pascal's Triangle
- TDD - From the Inside Out or the Outside In? by Georgina McFadyen
- TCR (Test && Commit || Revert) wrapper utility
- Collaborative timer for pairing or mobbing: mobti.me or agility timer
- 2-hour Randori Kata
Mixing top-down and bottom-up styles. This means starting with top-down, until we discover a brick that would be useful and that we decide to build bottom-up. When the brick is advanced enough, we can plug it back in the main code and do top-down again. We can then alternate a few times between both styles.
- Early integration of the code
- Understanding the difference between top-down and bottom-up
- Understanding how to make the best of both styles
Kata-PascalTriangle
and the accompanying materials are made available
under the terms of the MIT License which accompanies this
distribution, and is available at the Open Source site
See ACKNOWLEDGEMENTS.md for more information.
Damien Menanteau |
Philippe Bourgau |
Ahmad Atwi |
MirnaMx |