XProgramming > XP Magazine > Adventures in C#: XML Notepad Stories
COLLECTED TOPICS: Kate Oneal | Adventures in C# | Documentation in XP | Book Reviews
Adventures in C#: XML Notepad Stories
Ron Jeffries
07/10/2002
Chet and I are working with .NET and C#, to learn it, with a book or three in mind. An early application is the "XML Notepad". Here's the initial vision and some stories.

Contents:

Initial Vision

The XProgramming.com website is mostly generated from XML input, processed through some Ruby code to produce the indexes, and XSLT to generate the web pages in a consistent format. (An example of the format appears at the end of this article.) The XML format is pretty simple and straightforward, but it's a bit awkward to type in, because you have to embed all your paragraphs in <p></p> tags, and use other tags for sections and headings and the like. So we came up with a nifty product vision, and it goes like this:

There's this WYSIWYG editor that looks just like an XProgramming web page. You can type anywhere and edit the page. With a few simple control characters, you can select any of the special format items that the site's XML can contain. The page takes shape as you watch.

We immediately started negotiating with our customer (that's us), talking about feature value and cost estimates. Since we didn't know how to program in C# .NET at all, our cost estimates were pretty rough. But on the other hand, our customer (that's us) trusts us.

We think that WYSIWYG editing will be expensive, because of the difficulty we expect in figuring out where the cursor is, when typing into a formatted web page. We suggested that a Rich Text Format pane might be a good approximation and perhaps much easier to implement, and we did a brief spike with an RTF pane to get a sense for what is possible. We found that the RTF format itself is far more complex than either XML or HTML. Reporting this to our customer (that's us), we suggested a new direction for the first release:

Initial Release

We currently use a neat little product named TextPad to enter our XML. I'm typing into TextPad right now. We have a few macros defined, so that getting to the next paragraph or heading isn't too hard. But TextPad doesn't understand what we're about. What would an editor do that really "understood" what we're doing? Here are our initial stories.

  • When I'm typing a paragraph inside P tags, and hit a return, create another P tag underneath this one, and put the cursor in between the new tags, in the right typing location.
  • When I'm typing inside P tags, and I want this to be, say, Heading 2, typing control-2 will remove the P tags and replace them with H2. When I hit return inside H2, create a P tag underneath the H2 lien and put me inside it.
  • Same as H2 for H3.
  • Start the editor (File/New) not on an empty page, but on an empty template for my web site. Put the cursor inside the first unfilled tag, so I can just start typing the title or whatever it is.
  • When I type Tab in the editor, move the cursor to the next tag (or maybe the next unfilled tag). I'll have to try it to see what works best. Think of it as tabbing from field to field in a form.

At this point, we're not estimating these stories other than "OK" or "too hard". None of the above are "too hard", unlike some of the ones in the initial vision.These stories are more than enough, we think, for our first iteration and first release. Coming soon: the results of that iteration.

Later Releases

Since part of the purpose of this app is to learn .NET and C#, and since part of it is to write some book stuff, we may choose to push the application in some odd directions. It might make sense to replace the Ruby and XSLT code with .NET code to do the same thing, so that we can learn how that all works. It might make sense to make some kind of Web Service out of it, ostensibly so that people can submit articles to XProgramming, but again really to learn how to do things. Maybe we'll even do a database hookup to deal with indexing or the book list.

All those things might be useful. They're all the sort of thing you'd find in a typical Marketing product plan. We think that some of these ideas might have value, and some might not. As the project moves along, we'll keep you up to date on how our customer (that's us) thinks about investing in these features.


Appendix: The XProgramming Format

Here's what part of this page looks like in the XProgramming XML format:

<?xml version="1.0"?> 
<page>
	
	<header index="yes">
	<date updated="no">20020710</date>
		<title>Adventures in C#: XML Notepad Stories</title>
		<author>Ron Jeffries</author>
		<precis>Chet and I are working with .NET and C#, to learn it, with a 
		book or three in mind. An early application is the "XML Notepad". Here's 
		the initial vision and some stories. </precis>
	</header>

	
	<contents/>
	<sect1><title>Initial Vision</title>
	<P>The XProgramming.com website is mostly generated from XML input, processed 
	through some Ruby code to produce the indexes, and XSLT to generate the web pages 
	in a consistent format. The XML format is pretty simple and straightforward, but 
	it's a bit awkward to type in, because you have to embed all your paragraphs in 
	<p></p> tags, and use other tags for sections and headings and the like. 
	So we came up with a nifty product vision, and it goes like this:</P>
	<P>There's this WYSIWYG editor that looks just like an XProgramming web page. 
	You can type anywhere and edit the page. With a few simple control characters, 
	you can select any of the special format items that the site's XML can contain. 
	The page takes shape as you watch.</P>
	<P>We immediately started negotiating with our customer (that's us), talking 
	about feature value and cost estimates. Since we didn't know how to program in 
	C# .NET at all, our cost estimates were pretty rough. But on the other hand, 
	our customer (that's us) trusts us.</P>
	<P>We think that WYSIWYG editing will be expensive, because of the difficulty 
	we expect in figuring out where the cursor is, when typing into a formatted web 
	page. We suggested that a Rich Text Format pane might be a good approximation 
	and perhaps much easier to implement, and we did a brief spike with an RTF pane 
	to get a sense for what is possible. We found that the RTF format itself is far 
	more complex than either XML or HTML. Reporting this to our customer (that's us), 
	we suggested a new direction for the first release:</P>
	</sect1>	
	
XProgramming > XP Magazine > Adventures in C#: XML Notepad Stories
COLLECTED TOPICS: Kate Oneal | Adventures in C# | Documentation in XP | Book Reviews