Chapter 30: The Long Dark Teatime of the Soul


Before coming up with the optimized version of Undo in the previous chapter, I made three failed attempts to optimize it. The initial Undo had gone so smoothly, and the ideas seemed so clear in my mind, yet they would not come together. I would like to leave this report out, as it does not reflect my best moments. Still, there are bright spots even in the darkness , and perhaps you can learn from my mistakes as well, so here s a brief summary of what happened .

Recollection

In Chapter 28, Oh no! Undo! we saw that Undo fit into our system in exactly one place, an ideal situation. No sweeping edits all over the system were needed. I believe that this shows that incremental design can work and can be resilient to change. It s no proof that it will always work, but since Undo is one of the difficult examples that people often raise, it s at least encouraging.

Our first Undo did go in simply, which is encouraging, but it was incredibly inefficient in its use of storage. I might have left optimization as an exercise for the reader, but that would have weakened my main point about incremental development leading to a design that is easy to change. So in Chapter 29, The Final Optimized Undo, I showed one simple optimization that reduces the storage by about an order of magnitude. That, too, went in easily, and I feel that the main point is made about as well as it can be from a single demonstration. My belief, demonstrated but not fully proven here, is:

Lesson  

Incremental development, with due attention to refactoring, particularly to removal of duplication, leads to designs which are highly modular and therefore resilient to change.

However, as the preceding chapter suggests, things did not go entirely smoothly. Although the XML Notepad s design was demonstrably ready for Undo, in some way I was not ready. I fouled up the optimization feature several times in a row. The full report of those efforts (that is, my first take at this chapter) spans over seventy pages, and I ll send that report to you on request, if you want to read a chronicle of how the old fat guy fouled up his attempts to do something that was in fact quite simple.

In this chapter, we ll save some trees. I ll give you an overview of what happened, but I ll spare you the tedium of slogging through the mud with me. I ll also include some excerpts and snapshots from that original chapter, to illuminate what was going on, to show you signs of trouble that I should have seen, and perhaps even to draw some lessons from the mostly useless work that was done. I ll begin with one of those now:

start sidebar
Lesson: First-Take Excerpt ”Dragging On and On...

Perhaps the best sign that we are in trouble is that feeling that something we re doing is just dragging on and on. As you read this chapter, notice the dreadful sameness of what I m doing, again and again, over and over. There are moments of light and discovery, and the lessons in here are often good. Yet each time, I end where I begin, with perhaps a little more knowledge but with little real progress.

The good news is that each time I finally recognized that I was in trouble, took out my changes, and started over. As you read, try to spot where I went off the road, try to imagine what you could have done as my pair to help me see that I was off the road.

You might find yourself skipping over more and more pages, trying to find something interesting or useful. Think about how I could have recognized that I was doing work that any reasonable person would want to skip over. Think about how you can recognize that slogging situation in your own work. Try to use my time in the weeds to help you recognize your own so that you can get back on the road quickly.

Also, at this point in the project, I did something bad to my neck. It hurt horribly in my neck and shoulder, and it seemed to be paralyzing my arm. I was partly laid up for about a month. It was very hard to work at the computer, but I wanted to make progress on the Undo optimization. I did what seemed like some pretty good design, but as you ll read here, nothing very good came from it. Good-seeming design that didn t work ” that s worth thinking about.

end sidebar
 



Extreme Programming Adventures in C#
Javaв„ў EE 5 Tutorial, The (3rd Edition)
ISBN: 735619492
EAN: 2147483647
Year: 2006
Pages: 291

Similar book on Amazon

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net