Chapter 19: Dark Clouds on the Horizon


When Chet and I were pairing , we found a test that didn t communicate. Working on that, I thought of a bigger problem. The Shift+Enter idea is breaking a fundamental assumption of our program! This could get ugly!

We re in Big Trouble, Guys! [1]

My plan today was to clean up and publish the previous chapter about Shift+Enter. I was thinking about it while showering, and I realized that we ve got a big problem. Up until now, the basic idea of the TextModel object is that every line begins and ends with the same tag. The paragraphs aren t made up of lots of separate lines with a <P> on the first line and a </P> on the last: they are just one line. So our InsertParagraphTag() method just inserts a line after the current line, with a new paragraph tag on it.

Working on the <pre> tag in the previous chapter, we discovered that we want multiple lines inside that tag, typically lines of code. Fine, no problem. When we re done with the <pre> stuff, we want to hit Enter and get a new <P> tag and get back to typing text. However, if the user has the cursor up somewhere in the middle of the code, hitting Enter won t insert the <P> tags after the <pre> section! The new paragraph will get inserted right in the middle of the code segment.

This is just the sort of thing people fear with this simple design and refactoring stuff: some simple decision at the beginning is incorrect, and we go down some long path assuming that it will all work, and then suddenly bang we get a requirement that breaks everything. We re doomed!

Well, fact is, at this writing, I don t know whether we re doomed or not. I don t see my way out of the problem, and I haven t solved the problem. My belief, of course, is that simple design plus refactoring always works, so the change we need, whatever it is, won t be a big problem. A couple of chapters from now, we ll find out.

[1] Ed Anderi, personal communication.




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