I came across Ron Jeffries book Extreme Programming Adventures in C# on Agile Alliance members page, a book which he thinks should be called “Pairing with Ron”. It’s about the development of a small XML editing tool he did. But it describes every little test, refactoring and other anecdotes that are relevant.
I thought this to be fairly interesting, and since I have just started on a similar journey I though I’d start some kind of log of it here. Of course I have already done some basic things so I try to make this log catch up quickly.
I am trying to build an Object Application Modeller. The basic functionallity is to be able to define classes with attributes, relations and views. I have seen many applications where this is actually the basic functionallity, so maybe this tool exists already but since it’s a journey the goal is not the value, the journey in itself is.
The trick is to be able to “generate” an application from these definitions, with support for persistence of the instances of the classes and relations of course. *AND* with the possibility to upgrade, which will introduce the need to refactor the persistent storage (a.k.a database) on upgrade.
I’m sorry that I will not be able to remember all the steps I have already taken, but here are the initial list of User Stories:
- Define and Delete a Class
- Save an Application Definition and Restore it
- Add a (String/Integer type) attribute to a Class and Delete it
- Create instances of the defined classes (implies deploying the Application)
- Display instances as a table with attibutes
- Select which attributes to show
- Sort and filter data according to specific column
- Define Relations with attributes between specified Classes
- Show instances with attributes in a tree using a specific relation showing attributes
- Show instances with all relations
- Deploy an updated Application Definition to an existing Application
So I started with a test that creates a Dictionary, adds a Class to it and then looks up that same Class. No problems there, implemented the Dictionary as an ArrayList which took Class.
Then save and restore, almost as straight forward. Decided to use a simple text file with one line per Class.
Then, GUI! Since many have talked about thin GUI:s I first decided to use the Eclipse Visual Class editor to just add a simple GUI on top of the functions. That was just somewhat successful. And it felt bad. Why couldn’t I do TDD on the GUI?
Having introduced Automatic Testing of the webapplication in my current project I knew there where a multitude of GUI testers, but I surely did not want to go down the path that lead us to Mercury Quicktest Professional!!
But I found Abbot, “A Better Bot”! It drives and inspects Java GUI, and JUnit functionallity to boot! So I added some tests to drive my GUI components, and of course I had to refactor those a bit to make the testing easier.
So now I could add tests to drive adding attributes. And since I implemented those as ArrayLists too I refactored out an ItemList to hold Items which became a super class to Class and Attribute.
I have just added a test to drive adding attributes from the GUI. The first test is to select a Class, press the Edit button and ensure that an “Edit Attributes for Class” window appears. And that’s where I am now.
To be continued…