The Lesson


I ll include all the code for TextModel below for your comparison. But already we can see that it s much better now, and you can probably see how to make it even better. We have a much better design now ”but where did that design come from? We never sat down, reasoned about the program as a whole, or drew any diagrams, nor did we use any arcane incantations. We just removed duplication. Writing the words for this chapter was ten times harder than changing the code.

The power of removing duplication, in the presence of tests, is amazing. It turns programming from a process of building a mental house of cards into a simple code- crafting enterprise. It s rather relaxing . There was one moment there that got a little tense, and usually there is. But even there we didn t panic and didn t resort to the debugger. The problem was right in front of us, we fixed it, and we moved on.

Lesson  

Brushing the knots out of the code, one at a time, results in a smooth design, with little effort. We can see design improvements emerging here, and we aren t done yet. Let s review the code and then come back and see what else we can improve.




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

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