Detailed Requirements and Choices for Your Bi-Directional Word Processor

(In this description, ``you'' is the requirement engineer)

There are two extremes for the paradigm for the bidirectional word processor (BDWP):

  1. The user has full control over directionality of characters and the BDWP obeys as with Berry et al's bidirectional troff (that was used to typeset the Brief Bi-Directional Text Reading Lesson ).
  2. The user lets the BDWP determine the directionality of characters as described by the Unicode Bidirectional Algorithm (UBDA).
There are probably paradigms in between these extremes. If you can identify one and describe it fully and you think it's better than the two extremes, you are welcome to use it.

You and your customer have to decide what kind of user your BDWP will support. Then you and your customer have to pick one paradigm that is appropriate for this user. Then, the BDWP you specify follows this and only this paradigm.

Here are more details on the two paradigms:

In EITHER case, the characters are in Unicode and the file operated on by the BDWP follows the Unicode standard. That is, if you view the file that your BDWP has produced through any other fully Unicode compliant application, that application's visual order view is the same as your BDWP's visual order view. This assumption means that whatever paradigm you choose, your BDWP makes Unicode compliant files.

  1. User in Full Control:
    1. There are ONLY strong characters.

      Each character's direction is determined by the default direction of the alphabet of the keyboard through which the character is entered. That is, if the user is using a Hebrew keyboard, then typing a space results in an RTL space being put into the file. If the user is using an English keyboard, then typing a space results in an LTR space being put into the file. The same holds for all characters, e.g., digits and punctuation, which are classified as weak and neutral in Unicode; they are strong in this paradigm.

    2. There is no implicit embedding, but there is explicit embedding.

      Any sequence of characters, selected with the pointer (mouse), can be made a subdocument with either direction, LTR or RTL. Thus, if the user is making a LTR document that contains a RTL address that contains LTR digits in the middle of which are LTR characters, then the user will have to make the RTL address an RTL subdocument in order to get the LTR letters inside the digits not to be moved to the wrong place (See the bidirectional text reading lesson.).

    3. Any character can be forced to have either direction, even the opposite of its default.

      Any sequence of characters, selected with the pointer, can be given either direction, LTR or RTL. Thus, the user is able to specify a sequence of RTL characters to be LTR or a sequence of LTR characters to be RTL, e,g, in order to write a manual for a BDWP.

  2. BDWP chooses character directions as specified by the UBDA:
    1. There are strong, weak, and neutral characters, as specified by the UBDA. That is, no matter which keyboard a user uses to enter a space, the one Unicode space goes into the file. This space is neutral and has no default direction. Its direction is determined by its context according to the UBDA.
    2. There are control characters, i.e., LRM, RLM, LRE, RLE, LRO, RLO, PDF, with which a user can force character directions and embeddings that differ from the default specified by the UBDA.

The tradeoff, FROM THE USER'S VIEWPOINT, are:

  1. User in Full Control:
  2. BDWP chooses character directions as specified by the UBDA:
You should propose a single paradigm to match what you think your customer's user would want, given the tradeoffs. Then you and your customer will come to an agreement about the paradigm to use in your specification.

If you choose Paradigm 1, User in Full Control, then your BDWP will create the fiction that the user is under full control and that each character entered is strong, while, in fact, the file is stored according to the Unicode standard.

One possible way to achieve this fiction is for the BDWP to keep track of character directions and subdocuments and to drop control characters into the file in the correct places to cause the UBDA to interpret the file so that each character has the direction the user thinks it has and that the file's embeddings match the document--subdocument structure that the user thinks the file has.

If you choose Paradigm 2, the BDWP chooses character directions as specified by the UBDA. Even so, you have to choose a modus operandi from among a spectrum of modi operandi. The variation along this spectrum is according to the degree of well-formedness checking or enforcing that the BDWP does as the user enters control characters:

  1. Modus Operandi 1 (No checking or enforcing):

    There is a command to enter each control character at the place the cursor points. For each such command, the BDWP checks nothing and simply inserts the specified character at the place in the file pointed to by the cursor. However, the resulting visual order view will be unpredictable if the file is ill-formed, e.g., an LRE, RLE, LRO, or RLO is not paired with a matching PDF.

  2. Modus Operandi 2 (Checking):

    There is a command to enter each control character at the place the cursor points. For each such command, the BDWP checks that the placement of the control characters follows the constraints for well-formedness, e.g., that embedding and overriding commands are paired properly with PDFs. You will have to decide how to treat the situation in which an embedding or overriding has been started, but its corresponding PDF has not been given yet.

  3. Modus Operandi 3 (Enforcing):

    There is a command to enter each of LRM and RLM at the place the cursor points. There is a command to enter each of a LRE-PDF, a RLE-PDF, a LRO-PDF, and a RLO-PDF pair at the beginning and end of the region selected by the current selection. With such commands, it is guaranteed that the entered control characters follow the constraints for well-formedness.

Modus operandi 2 seems to be in the spectrum between modus operandi 1 and modus operandi 3. There are probably modi operandi that lay elsewhere in the spectrum. If you choose Paradigm 2, you must choose a modus operandi that suits your customer's user.

Your user's manual must describe somewhere in the beginning the chosen paradigm and the chosen modus operandi if it is relevant for your chosen paradigm.

The above has described the paradigms and modi operandi in terms of what the user DOES and can DO, but there is more. No matter what paradigm and modus operandi you choose, you need to provide commands that allow the user to VIEW what he has input and to see how the software has interpreted what is in the file. This ability to view is particularly important when the software is going to be making default assumptions that may differ from the user's intent. Even when the user is in full control, he can make mistakes (REALLY???), and therefore, the user needs to be able to see how the software has interpreted what he has entered.

So you will need commands to show:

It might be useful to allow commands to combine their effects.

Note that in a showing of a file in logical order,

Note that one could achieve these views by

  1. having a command for each
  2. having attributes that can be set or unset that apply to the current view
It is your choice how to achieve these views.

Finally, no matter your paradigm and modus operandi don't forget to deal with:

The problem with a selection that crosses a direction change boundary, which does not have to be the beginning of an embedding or an overriding, is the cognitive dissonance caused by the fact that as the selection crosses the direction change boundary, the highlighted region starts to grow in the direction opposite that of the hand movement. So, the user is tempted to start moving the hand the other way. But, moving the other way should cause undoing of the selection, not growing of the selection.

There are at least two ways to deal with this cognitive dissonance:

  1. Find a whole new way to implement the highlighting that avoids the problem.
  2. Accept that cognitive dissonance will happen when a selection is done across a direction change boundary in the visually ordered view, but provide a logically ordered view in which the selection can be done without cognitive dissonance.