Tuesday, May 5, 2015

Kata: String Calculator in Clojure

Last week we started working on the String Calculator kata at the Clojure Developers Barcelona meetup.

Finally, this week I found some time to finish it.

These are the tests using Midje:

The resulting code which is divided in several name spaces.

The string-calculator.core name space:

The string-calculator.numbers-parser which is where most of the logic lives:

The string-calculator.numbers-validation name space:

Finally, the string-calculator.numbers-filter name space:

I used a mix of TDD and REPL-driven development to code it.

To document the process I committed the code after every passing test and every refactoring.

This time I didn't commit the REPL history because I used Cursive and I didn't find how to save it. Apart from that, I really enjoyed the experience of using Cursive.

You can find the commits step by step here and the code in this repository in GitHub.

No comments:

Post a Comment