July 6, 2010 5

Codebreaker in C# by Antonio Lucca

By Corey Haines in Katas, Software Craftsmanship

After a long break, we have a fantastic katacast to present to you. Antonio Lucca contacted me with a new, C# version of the codebreaker kata. I started watching it and was blown away. Is that C#? In Vim? With autotest-like functionality? Super sweet! Without more rambling from me, here’s a bit about Antonio:

Antonio Lucca is a software journeyman, thinker and learner, and Scrum Master. He lives in Milano, Italy, at the moment. He is interested in principles and practices that helps making software development sustainable, efficient and fun.

Here’s what he has to say about doing the kata:

The first test cases are the non positional matches, then by some refactoring everything comes up to a linq expression.
The next test is related to a more intriguing case: Avoid counting twice a color that has already a match (the “mm” expected as result for a “yyxb” guess against a “rgby” secret, where the actual result is “mmm”, counting ‘y’ twice).
I commented that test for a while, and then did some refactoring until the base code was ready to implement just the logic needed to let that test pass.
After that I implemented the positional match as a special case of the non-positional match, and then put them together in the Mark method.
The tools that I used are autobuild (from google code), nunit growl addin, and… gvim.

One of the awesome things is the toolset he is using. You should watch it first, then come read how he did it. Here’s a write-up of this:

I have a visual studio solution, but should not be not strictly required, however I didn’t try without having the visual studio solution. (I mean a build file in .sln format, suitable for the dot.net sdk msbuild command line tool).
If you have only the dot.net sdk could work as well, as long as you can modify the autobuil.build nant file, that should be straghforward. however I havent tried yet. the free c# express edition to create solution file may works as well.
Another possibility is avoid reference to the solution and modify the autobuild.build nant file to simply compile the sources via csc compiler.

However this is my configuration:
1- you have a visual studio format solution folder of a project that referenced the nunit assembly (nunit.framework.dll)
2- you have installed the autobuild from http://code.google.com/p/autobuildtool
3- you have nunit version 2.5.5, and nunit growl notification addin, and growl as well
4- you have a output named output (or whatever) where you copy “stuffs” as described in http://timross.wordpress.com/2009/08/04/continuous-testing-in-net/
5- you modify there the autobuild.build file in the output directory to let it reference the solution file of your project (or call the plain source files compilation via “csc”. As I told, I didn’t try)
6- on that file you change the “run-unit-tests” target so that it will call the external command line nunit-console that takes as argument the assembly generated by the build, (usually in bin\debug) redirecting the output on a file. Avoid using the nant2 task because it didn’t work (to me).
7- open two different windows command prompt (cmd). One where you can launch autobuild.cmd, another one simply to show the nunit-console output redirected to the compiled file (dll assembly or .exe). you need to show the file via tail -f. So a tail tool should be available as well, for example having cygwin installed.
8- should be ready. Be sure that growl is running. Create a single failing test and if you launch the (included in autobuild) nant to autobuild.build file it will build the project and execute the tests, and the nunit notification should “growl”. Sometimes modification of the solution file (.sln) can be required, because, for instance the build does not see the output folder for the compiled.
If the point 8 is ok, then launching autobuild.cmd should be able to do everything in background and so any change in any source file of the project will make the solution be rebuilded and test executed and notified in growl and in the output file (accessed via “tail -f”).

If you’d like to contact Antonio, here’s some info:
Hompage: http://tonyxzt.blogspot.com/
Twitter: tonyxzt


CodeBreaker marking guess revised from tonyx on Vimeo.

March 5, 2010 4

Michał Kwiatkowski – Sum of Even Fibonacci Numbers

By Corey Haines in Katas, Software Craftsmanship

After a short break, we are back with an interesting kata in Clojure. Michał Kwiatkowski has tackled a project euler problem, finding the sum of the even Fibonacci numbers less than 4 million. Fun, indeed. Included in this katacast are 3 different solutions.
Michał Kwiatkowski is a software developer from Gdańsk, Poland. He builds RoR applications and [...]

February 11, 2010 1

String Calculator – Clojure

By Corey Haines in Katas

Okay, okay, I know that I said we weren’t going to have another string calculator kata, but this one is in Clojure, and I wanted to get it up on the site. It is fun to watch, especially if you compare it to the Scheme one. Tom Crayford has been working on it for a [...]

February 1, 2010 1

String Calculator – Groovy

By Corey Haines in Katas, Uncategorized

After being away for a couple weeks due to conferences and sickness, we present another entry in our “Same Kata, Different Languages” series: the String Calculator in Groovy by Itay Maman. This will most likely be the last of the String Calculator katas for a while, as we’ve been doing them for a long time [...]

January 7, 2010 5

Prime Factors Kata (Annotated)

By unclebob in Katas

Uncle Bob walks and talks his way through the Prime Factors Kata.
No music, but lots of commentary.

January 6, 2010 16

String Calculator – Python

By Corey Haines in Katas, Software Craftsmanship

Continuing our series of ‘Same Kata, Different Languages,’ we have a very special performance in Python by Gary Bernhardt:
Gary Bernhardt is an independent software contractor in Seattle specializing in the dynamic languages Python and Ruby. A brutal minimalist, he is bent on the destruction of all existing software except Emacs and Vim, the two One True Editors.
Gary’s a [...]

December 30, 2009 5

String Calculator – Scheme

By Enrique Comba Riepenhausen in Katas, Software Craftsmanship

Next in the series ’same Kata, different language’ I wanted to post my very own Kata in Scheme.
Currently I am learning Scheme. Due to my lack of knowledge in Scheme I could not write the tests (nor code) for the negative numbers part of the string calculator. I would have loved to get there, but [...]

December 27, 2009 0

My Response to Roy Osherove’s Feedback on my String Calculator Kata

By Corey Haines in Feedback

Since the String Calculator kata was posed by Roy Osherove, I asked him to take a look at my solution and give me feedback. He was kind enough to write an insightful blog post with some comments. Since he took the time to write them, I thought it fair to weigh in with my responses.
Partial [...]

December 24, 2009 4

String Calculator – Scala

By Corey Haines in Katas

Continuing our series of ’same kata, different languages,’ Giordano Scalzo provides us with a great view of the kata in Scala. I’ve fooled around a little bit with Scala, but definitely felt like I was just writing java in a not-quite-different environment. Watching Giordano code was very refreshing.
Giordano Scalzo is a Software “jack of all [...]

December 17, 2009 9

String Calculator – Erlang

By Corey Haines in Katas

For our first in the series of ’same kata, multiple languages,’ we have a treat for everyone, Gabriele Lana is doing it in Erlang.
Gabriele Lana is a software journeyman living in Milan (Italy). Since 1998 he works as a developer and consultant. In 2000 he started using Agile practices in real time and embedded industries, proving their effectiveness [...]