Tangential comments about Software Development

Tuesday, February 25, 2014

Enough Design Up Front

I was on a long-haul flight from Singapore to London, with only a Daily Telegraph to read. They carry "sujiko" puzzles, where you fit the numbers 1 to 9 into a grid such that the 2x2 totals are values that have been specified. I decided to write a microsite to solve such puzzles.

The result is here : No awards for design or coding quality, as this was an exercise in "Enough Design Up Front" - what happens if you think through the problem before coding. In part this was to protect my laptop battery.

So I designed a strategy - work out all the "quartets" that come to each constraint total, remove those that do not meet any constraint numbers in the grid, then iterate through every combination checking that the overlap counts are correct - top left quartet must share two numbers with top right and bottom left, and one number with bottom right.

I got the result I wanted - a solver which works. But the EDUF process did not help especially. Some of the design decisions were effectively trivial and would have been no worse if considered just when I came to code them. And some decisions turned out to be far too high-level, specifically "generate the quartets" was just tossed out there, but turned out to be a somewhat gnarly bit of recursive code to get right.

Conclusion: I shall continue with my "emerging design" approach, developing the detail of a design as I code.