Skip to content

murex/Kata-PascalTriangle

Repository files navigation

Gradle Maven CMake Go Pytest Npm Check Markdown links Add contributors

Pascal Triangle

Animated GIF of the Pascal Triangle
"PascalTriangleAnimated2" by Hersfold in Public Domain

Description

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.

What are Bottom-up and Top-down TDD?

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:

  1. Write an acceptance test, and comment it
  2. Test drive the implementation of each brick
  3. Using all the bricks, test drive the implementation of the main function
  4. Uncomment and pass your acceptance test

Note: Bottom-up / Top-down are also known as Inside-out / Outside-in

The pros of Bottom-up TDD?

  • It lets you work in small steps
  • It tends to result in more reusable and robust bricks

The cons of Bottom-up TDD?

  • 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

Getting Started

Session Quick Retrospective

You can fill it from here

Useful Links

For this Kata

General

Session Information

Style & Duration

Topic

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.

Focus Points

  • Early integration of the code
  • Understanding the difference between top-down and bottom-up
  • Understanding how to make the best of both styles

Source Files

License

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

Acknowledgements

See ACKNOWLEDGEMENTS.md for more information.

Contributors

Damien
Damien Menanteau
Philippe
Philippe Bourgau
Ahmad
Ahmad Atwi
MirnaMx/
MirnaMx