In July of 2001, I spent three weeks trying to turn a project around. I had only recently learned about Extreme Programming and this was my first attempt at using it. The short-term results were quite spectacular, the long-term, less so.
So we're evaluating expressions. Now we are to create a two-dimensional adapter for Sheet so cells can be referenced by row and column. Since this specific interface is aimed at a Java-based GUI, I'm not really sure if I need all of it. But I've put it together quickly using the tests Bill supplied.
Having built the parser in Part 2 and cleaned it up in my Refactoring Interlude, I'm now ready to handle references to cells in the formulas. First step is to have a new token type that handles "names". I made these be any span of alphanumerics starting with an alpha. This is actually a superset of the pattern called for in Bill's tests, but it can be changed later if necessary. Here's the new version of LexicalToken.
In Part 2 I developed a parser that handles integer constants and some operators. In doing this, I built up some design debt and I now need to refactor. In addition, Part 3 now calls for formulas to handle references to other cells. This will call for some preliminary refactoring based on some quick design thinking. On this page I describe both refactorings and also discuss how I feel about all this change.
Part 1 was originally done with only one string holding the content for all the cells. As expected, this broke on the first test of Part 2 (testManyCells) and some refactoring was required.
Bill Wake created the Test-first Challenge as a way for people to practice test-first. He provided a set of tests that drive the development of a simple spreadsheet application. A number of people who frequent the extreme programming list wrote code in response to Bill's tests, including me.