An Initial Attempt


Then I got down to work by trying to build an object called UndoAnalyzer. This object didn t do anything useful, but it took two TextModels and compared them, using the selection information as well as the lines. I worked for eight or ten book pages on the Analyzer and never even tried the idea of comparing all the lines, the only really simple idea I had. Instead, I kept fiddling with combinations of the beginning and ending selections of the before and after Snapshots. This was a mistake on the face of it: the object s name alone tells us that it is some kind of assumed infrastructure object or perhaps a test probe.

I pushed on this course for quite a while, three or four hours, trying hard to make it work. I added extra variables to TextModel, to save the lines that I felt were indicated as important by the selection. This, too, was an indicator of trouble, as TextModel had no use for that information and never would have. I was hacking, in the worst sense of the word. At one point in this first push, I slowed down and wrote, I owe it to myself , when these uncertainties arise, to slow down and consider taking another route.

And after giving myself this good advice? This: ...waist deep in the Big Muddy, the big fool said to press on. I pressed on for a few more pages, took another break, examined the code and finally decided to back it out and start over. All this spans about twenty book pages and about four hours work. The page count seems high for as much work as got done, probably because I was confused most of the time and had to do a lot of explaining. Toward the end of this section, I said the following. It s good advice, which I should have followed sooner.

start sidebar
Lesson: First-Take Excerpt ”The Value of Reflection

I realize now that I haven t been proceeding as effectively as I might have in this last push to come up with the optimized TextModel. The work done isn t wasted , but it could have been put off in favor of faster learning.

All this effort of copying the lines around is wasted: we already have the lines in the TextModel. We could have just figured out which lines were interesting and stopped there.

I had been thinking, of course, that we would need these lines in the final version, so it seemed to make sense to get them. But what s important is putting the right lines back when we do the Undo and whether this scheme will work at all. A faster approach with more learning might have been to record the interesting line numbers ”the beginning and end lines of the selections in old and new versions ”and just use them to get the lines out of the existing TextModel Lines array. That would have been a more effective way to learn whether this approach will work and what it will take to make it work.

The lesson isn t that I made a mistake. I learned a long time ago that I make mistakes, and probably you have as well. The lesson is that the more frequently we take a break to reflect on how things are going, the sooner we are likely to realize when we re off the best track. We can decide, then, whether to backtrack, change direction a bit, or just go ahead. Deciding is the important thing, and to make a real decision, we need to reflect.

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