Exploration Through ExampleExample-driven development, Agile testing, context-driven testing, Agile programming, Ruby, and other things of interest to Brian Marick
|
Sun, 28 Jan 2007The simplest thing you could possibly decide I've been working some more on my sample model-view-presenter app, mainly finishing up the Fit tests in preparation to changing gears and "repurposing" it as an Ajax app. I've been adding new UI behaviors bit by bit. As I've been doing so, the app's complexity has been bugging me. As you may recall, any change to UI can affect as many as 10 classes (three model/view/presenter classes for each of three windows, plus a coordinator class that keeps MVP triads in sync). This somehow doesn't seem to square with Beck's advice to minimize classes and methods, nor with Do The Simplest Thing That Could Possibly Work. However, I realized that a big part of test-driven design is to make each decision small by deferring other parts of the problem until later. MVP is like that. You begin with a test that describes what one user gesture does to everything visible on the screen. That gesture drives a pretty obvious change to the View, which drives a pretty obvious change to the Presenter, which drives a pretty obvious change to the Model (what I've been calling the Application object). That drives a pretty obvious change to the Coordinator, which... It's all fairly rote, and there are nice milestones along the way as each window comes into conformance with the business-facing test. I feel better after realizing that. The coding still seems slow. (Though, as Ward Cunningham once said, TDD always seems slow until you get to the end of the week and realize how much you've done. So I may just be impatient.) What remains to be seen is how all this will handle change. That's the reason I'm going to switch to a radically different UI. Instead of looking like a multi-document/multi-window app, I'm going to model it after the Synk synchronization/backup program. (Click through the picture to see more.) |
|