A word processor is a complicated creature of many layers and pieces, but it represents a relatively simple concept: a piece of paper with writing on it. This leads to the problem of having many abstractions without enough intuitive names to describe those abstractions. Not everything can be a document. The solution to this sort of problem is usually finding powerful metaphors that make life easier.

Here are some of the abstractions for a document that need intuitive names:

  1. The data structure that breaks up plain text into meaningful pieces such as chapters, sections, headings, and various kinds of emphasis. This is the most abstract document because it avoids all rendering information like fonts, colors, underlines, or alignments.
  2. The data structure that provides text with rendering information such as fonts, colors, sizes, alignments. This also represents a document, but at a level that is closer to the printed page. It probably uses an instance of the first kind of document to help generate the content.
  3. The data structure that arranges glyphs into lines of text. This document can be given the number of a desired paragraph, a position within that paragraph, and a maximum width in pixels, and it produces a data structure that represents a line of text ready to draw. It makes sense to base this document abstraction upon an instance of the previous document abstraction because they both represent documents at different stages in the rendering process.
  4. The final data structure stores lines of text in their relative positions on the screen or page. It is capable of drawing an entire screen of text, inserting figures, and making columns. It knows which part of the document is currently visible, handles scrolling or dividing the document into pages for printing. This document abstraction is the very closest to the paper, but does that make it most worthy to be called document, or is the most abstract layer the true document since it is what the user is truly editing?

All four concepts are documents in their own way, but I can't call them all documents; that would be confusing. What is the proper metaphor to use here? Something that intuitively reflects the complexity of the task better than a document?

On top of all that, there are three different ways to represent a position within a paragraph.

  1. Measured in characters from the start of the paragraph
  2. Measured as a line number starting from the first line of the paragraph and then measured in characters from the start of the line
  3. Measured in pixels as the paragraph is rendered on the screen

These three representations are all positions, but things become confusing if I call them all positions. I need a simple way to distinguish them, something that fits well with the improved metaphor that I'll use to distinguish the four kinds of document.

I have looked into typography in search of good metaphors, but nothing jumps out at me.

I have also considered a metaphor from constructing a building. The first kind of document could be a Blueprint, the second kind could be a Foundation. Unfortunately #3 and #4 aren't clear, and it doesn't seem to help with the issue of paragraph positions.

  • 4
    Abstractions #3 and #4 are your own fantasy, I'm afraid. You cannot lay out anything that resembles good looking text while limiting yourself just to one line at a time, or one paragraph, or even one page. A document has to be laid out in entirety, where content on any page can potentially impact any other page in the document, and it is device dependent so screen and paper will differ if readability is at stake. To have an idea about what it takes to lay out good looking text, just look at how TeX does it. – Reinstate Monica Sep 8 '13 at 7:42
  • @Kuba I don't think ragged-right is a real problem in an editor. If TeX quality is desired for printing then TeX files can be output. – Geo Sep 8 '13 at 20:03
  • Decent word processors try to approximate TeX, with varying levels of success. It makes no sense to provide an "abstraction" that doesn't cover the basics of text layout that have been practiced for hundreds of years. You're not talking about an editor, you're talking about a word processor. If all you want is TeX output, then LyX is there, no need to reinvent the wheel. If all you want is an editor, then look at various abstractions present in editor toolkits. – Reinstate Monica Sep 9 '13 at 0:42
  • 1
    This question appears to be off-topic because it is about finding metaphors. Design questions would be on topic, but this would probably be too broad anyway even if it asked for a design instead of a metaphor. – psr Apr 15 '14 at 0:15

it represents a relatively simple concept: a piece of paper with writing on it.

That would be a text editor. A Word Processor is a text editor with various extensions to aid in the task of writing. It's most akin to the old layout staff at a newspaper, or perhaps a document secretary, than a simple piece of paper.

Name Suggestions for stages of a Word Processor Document

  1. Document (or "SavedDocument" or "UserDocument") is the core data structure, which is what you save to disk. It contains the main text, chapter/subchapter breaks, any index markers, emphasis styles, footnotes, and anything else that the user might intentionally declare. This may include specific formatting, in addition to styles, but only if specified by the user.

  2. StyledDocument is a Document with its saved information expanded based on a StyleTemplate, into specific page sizes, fonts, colors, alignments, and other information.

  3. TypesetDocument is a StyledDocument with all of the characters translated to the necessary glyphs and so forth, but without final processing that may vary based on its form of output.

  4. RenderedDocument is a TypeSetDocument with the final steps necessary to output to a final medium, be it paper or screen.

Name suggestions for position within a range:

(You don't want entirely different names based on your origin, do you? A document, paragraph, or selection within a paragraph can all have distinct positions...)

  1. naturalPosition: number of characters from the start of the paragraph, without regard to lines.
  2. wrappedPosition: number of lines within a pararaph, and number of characters from the start of a line.
  3. renderedPosition: numeric X,Y coordinates based on the final rendering device, be it pixels or not.

One more thing

Please hear my plea, on behalf of all who may come after you, to choose your names and metaphors early, and if at all possible to keep them consistent from your initial diagrams through your class and property names and all the way to your user interface. If you find the names and metaphors lacking latter on, take the time to refactor them so as to keep your code as intuitive and self-documenting as possible.

If you take my names for the first suggestion, you'll probably have to wind up with a "ScreenTypesetDocument" and a "ScreenRenderedDocument", with corresponding "PrinterTypesetDocument" and "PrinterRenderedDocument" for when someone wants to print something. But if you decide that "Rendered" is the wrong word and you want it to be "Drawn" instead, make sure to re-name all three classes and not just the abstract "RenderedDocument".

| improve this answer | |

Not exact but the best I could relate is:

  1. Document and Document Parts.
  2. Text Attributes
  3. Text Lines
  4. Character Attributes

2nd set:

  1. character indents
  2. position as an x,y coordinate
  3. pixel indent
| improve this answer | |
  • 1
    +1 for the Captain Obvious answer to an overwrought question :-) – Ross Patterson Sep 8 '13 at 14:47
  • Good suggestions. Text Attributes and Character Attributes seem too similar to use both since it wouldn't be clear which meant which, unless I'm missing something. I don't understand the reasoning behind the position suggestions, and "indent" might get confused with the typographic meaning of that word. – Geo Sep 8 '13 at 20:36

Not the answer you're looking for? Browse other questions tagged or ask your own question.