tdd

Recursos de programación de tdd
I just did the Integer Ranges kata in Clojure. These are the tests using Midje: and this is the resulting code: As usual I used a mix of TDD and REPL-driven development committing after each green and each refactoring. I also committed the REPL history. See all the commits here if you want to follow the process. You can find all the code on GitHub. - por Garajeando
Web
23-09-2015
Yesterday I did the Password validation kata in Python. I used TDD to write the code. These are the tests using Pytest: and this is the resulting code: If you want to follow the process step by step, have a look at the commits. You can find all the code in GitHub. - por Garajeando
Last night I did the Word Wrap kata in Clojure. It was proposed in the last Barcelona Software Craftsmanship coding dojo but I couldn't attend, so I did it at home. These are the tests using Midje: and this is the resulting code: As usual I used a mix of TDD and REPL-driven development committing after each green and each refactoring. I also committed the REPL history. See all the commits here to follow the process. Once I got to a tail recursive solution, I tried to make it more readable by...
Web
11-09-2015
http , java , tdd
Lately I've been working bit by bit in an implementation of the Glowworm Swarm Optimization algorithm (GSO) in Clojure. Some time ago I implemented the GSO algorithm in C++ to practice TDD. I decided to implement it it again in Clojure to practice with something larger that Exercism exercises or katas an yet small and familiar enough to finish it in spare bits of time. This is the code of the resulting Clojure GSO on GitHub. This GSO Clojure version is much shorter than its C++ version. Aside fr...
Yesterday we practiced doing the Sieve of Eratosthenes kata at a Barcelona Software Craftsmanship event. My partner Fernando Mora and I used TDD in Scala to write the code. Today I did it once again in Clojure. I'd like to explain here how I did it step by step in order to share it with the Barcelona Software Craftsmanship members. I started by writing this test: which I quickly got to green by just hard-coding the response: In this first test I used wishful thinking to get the function and s...
Web
26-08-2015
http , rest , java , tdd
4. Introducing a test harness.To be able to refactor Alarm, we first need to protect its current behavior (its check method) from regressions by writing tests for it. The implicit dependency of Alarm on Sensor makes Alarm difficult to test. However, it's the fact that Sensor returns random values that makes Alarm impossible to test because the measured pressure values it gets are not deterministic. It seems we're trapped in a vicious circle: in order to refactor the code (improving its design wi...
1. Introduction.Last week I facilitated a guided kata for a Gran Canaria Ágil event in Aplicaciones Informáticas Domingo Alonso (thanks to both for inviting me) in which I explained a possible way to solve Luca Minudel's Tire Pressure Monitoring System exercise. This exercise is part of his TDD with Mock Objects: Design Principles and Emergent Properties exercises. I like these exercises very much because they contain clear violations of the SOLID principles but they are sill small enough to be...
Web
05-08-2015
http , go , tdd , ddd
We were working through the following iterations of an exercise: First iterationA user can register with a user name. For instance: @foolano If anyone else has already registered with that name there is an error. Second iterationA user can follow another users. To do so it's only required to know the user name of the user to be followed. Anyone can query the followers of any given user just knowing its user name. Third iterationThe registered users and their followers must be persisted. (source:...
Yesterday we did the Print Diamond kata in the Clojure Developers Barcelona group. I paired with Rafa Gómez. We managed to complete a recursive solution to the problem using our usual mix of TDD and REPL-driven development. Later, we showed our solution and realize that, even though, it worked fine, we had to improve the names of some helper functions we had created to make our solution easier to understand. After that, Samuel Lê, presented on the whiteboard (we couldn't connect his laptop to th...
Web
26-07-2015
http , tdd
Some weeks ago I did the the Binary Search Tree problem from Exercism in Clojure. I used TDD using some of the sample tests that Exercism provided and some other that I added. These were the tests, after deleting some redundant ones: And this was the binary search tree code: I was just testing a few cases. To gain confidence in my solution and play a bit more with the exercise, I decided to apply a bit of property-based testing on it. So I added the clojure/test.check dependency to my projec...