Tuesday, December 30, 2014

Books I read (2014)

- Pan, educación, libertad (Ψωμί, παιδεία, ελευθερία), Petros Márkaris
- NW London, Zadie Smith
- 101 cuentos clásicos de la China, Chang Shiru, Ramiro A. Calle
- Mr. Neighborly's Humble Little Ruby Book, Jeremy McAnally

- Blankets, Craig Thompson

- Practical Object-Oriented Design in Ruby, Sandi Metz
- Modern C++ Programming with Test-Driven Development, Jeff Langr

- Learning PHP, MySQL & JavaScript, Robin Nixon
- Measuring the world, Daniel Kehlmann

- El hombre que plantaba árboles, (L'homme qui plantait des arbres), Jean Giono
- Extreme Programming Explained, Embrace Change, Kent Beck
- Adiós, Chunky Rice, (Good-bye, Chunky Rice), Craig Thompson

- Eloquent Ruby, Russ Olsen
- Implementing Domain-Driven Design, Vaughn Vernon

- JavaScript Allongé, Reginald Braithwaite
- JavaScript: The Good Parts, Douglas Crockford

- Programming Clojure, (2nd edition), Stuart Halloway and Aaron Bedra
- Introduction to Computing, Explorations in Language, Logic and Machines, David Evans
- JavaScript Allongé, Reginald Braithwaite (2nd time)

- Functional JavaScript, Introducing Functional Programming with Underscore.js, M. Fogus
- Functional Thinking, Paradigm Over Syntax, Neal Ford
- Understanding the Four Rules of Simple Design, Corey Haines
- A People's History of London, Lindsey German and John Rees

- Software Craftsmanship: Professionalism, Pragmatism, Pride, Sandro Mancuso

- Me llamo Rojo (Benim Adım Kırmızı), Orhan Pamuk (2nd time)
- Clojure Programming, Chas Emerick, Brian Carper and Christophe Grand
- The Little Schemer, Daniel P. Friedman and Matthias Felleisen

Tuesday, December 16, 2014

Clojure Developers Barcelona: Talk about Clojure destructuring

Today I gave a talk about destructuring in Clojure for some of the Clojure study group members.

This is the "clean version" of the code I wrote on the fly on Lightable to explain destructuring:

I had a great time and learned a lot preparing the talk.

I hope this small study group will be help to get the Clojure Developers Barcelona Group up and running again soon.

Thanks all for coming.


I repeated this talk yesterday.

I updated the code in the gist shown above.

Monday, December 15, 2014

Kata: Roman Numerals in Clojure (2nd time)

I've just redone the Roman Numerals kata in Clojure following the advices about test-driving algorithms that Sandro Mancuso gave during his Crafted Code course:
  • Grow an algorithm bit by bit
  • Delay treating exceptions (in this case, because they are more complex)
  • Intentionally cause duplication
  • Focus on simple structures first
The resulting code to convert decimals up to 3999 to roman numerals is much simpler than the code I got the first time I did the kata.

I think the reason is that the first time I started refactoring too soon and that hid the duplication pattern that would have lead me to this simpler solution.

As in the previous version, I extended the kata to also convert decimal numbers over 3999.

This is the resulting code:

and these are the tests using Midje:

To document the TDD process I commited the code after every passing test and every refactor. You can find the commits step by step here.

This time it was a bit easier to derive the algorithm only using strict TDD.

You can find all the code in this repository in GitHub.

Friday, December 12, 2014

Kata: Studious Student in Clojure

Last week Leo Antoli facilitated a kata for Software Craftsmanship Barcelona.

We had to solve the Studious Student exercise.

Leo wanted us to experiment how useful testing is in an exercise like this one, so we divided the group in some pairs using TDD, some pairs testing after writing the code and some pairs not testing at all.

The exercise is a bit tricky as pairs that were not testing discovered at the end, whereas the ones doing TDD or testing after coding discovered early during the process.

After an iteration of one hour, we had a very interesting debate about automatic testing.

This is my solution of the exercise in Clojure:

and these are the tests using Midje:

You can see all the code in this GitHub repository.

I'd like to thank Leo for being so kind and sharing his knowledge with us.

Reading GOOS (IX)

These are the links mentioned in last two weeks conversations about the 12th and 13th chapters:
  1. Posts and Papers
  2. Talks