Ok titolo altisonante… ma con un kata interessante!
L’esercizio si articola come segue
Part One: Weather Data
In weather.dat you’ll find daily weather data for Morristown, NJ for June 2002. Download this text file, then write a program to output the day number (column one) with the smallest temperature spread (the maximum temperature is the second column, the minimum the third column).
Part Two: Soccer League Table
The file football.dat contains the results from the English Premier League for 2001/2. The columns labeled ‘F’ and ‘A’ contain the total number of goals scored for and against each team in that season (so Arsenal scored 79 goals against opponents, and had 36 goals scored against them). Write a program to print the name of the team with the smallest difference in ‘for’ and ‘against’ goals.
Ho messo tutto su questo repository mercurial ( anche i file dat).
Inizialmente ho implementato i due parser separatamente, in giorni diversi. Il terzo giorno ho esaminato i due sorgenti e , poco sorprendentemente ho trovato i punti comuni che ho rifattorizzato in una superclasse.
La cosa sorprendente è stata che , usando un approccio TDD, la cosa mi ha portato via solo pochi secondi.
Long live the TDD!