Scala Kata Session
This time we at Scala Usergroup Berlin toke a more practical approach than just talking. Together we tackled the kata FooBarQix from CodingDojo.org. FooBarQix is an extension of the classical BizzBuzz. It’s a simulates how code evolves when more and more features are added.
During the introduction I proposed a simple TDD cycle for this session:
- write a useful test, that tests only one feature and fails for the right reasons
- implement only as much is needed to make the test green
- optional, if and only if a pattern repeats three times: refactor your code.
- go back to step 1
The Scala Center provides simple templates to start new projects. With a simple sbt new scala/scalatest-example.g8
everybody was able to start quickly.
It was fun to see how the group applied different approaches to solve the Kata. This was the first time I saw property based testing used in this Kata.
That in turn started a discussion what to do if your code you want to test and the tests them self become nearly identical.