Warnier/Orr Diagrams

Introduction

Warnier/Orr diagrams are a kind of hierarchical flowchart that allows us to describe the organization of data and procedures.

There are four basic constructs used on Warnier/Orr diagrams: hierarchy, sequence, repetition, and alternation. There are also two slightly more advanced concepts that are occasionally needed: concurrency and recursion. Each of these six diagramming constructs are illustrated in the sections that follow.

Hierarchy

Hierarchy is the most fundamental of all of the Warnier/Orr constructs. It is simply a nested group of sets and subsets shown as a set of nested brackets. In fact, in traversing this tutorial you have been traversing a hierarchical presentation: big topics break down into smaller topics which break down into smaller topics, and so on ad infinitum. The following is an example of a simple hierarchy.

Each bracket on the diagram (depending on how you represent it, the character is usually more like a brace "{" than a bracket "[", but we call them "brackets") represents one level of hierarchy. The hierarchy or structure that is represented on the diagram can show the organization of data or processing. However, both data and processing are never shown on the same diagram. See the examples which follow for an illustration of a data structure and a processing structure.

Using a Warnier/Orr diagram to show a data structure:

Notice that the brackets name groups of data, and that the elements (the features that do not decompose further) are data elements.

Using a Warnier/Orr diagram to show a processing structure:

Note that the brackets are names of groups of processes, and the elements (the features that do not decompose further) are individual processing actions.

Each bracket on a diagram can be interpreted with the phrase "consists of" or "is composed of" when you read them. In other words, the diagram

can be read as follows: A week consists of a work week and a weekend. A work week consists of Monday through Friday, and a weekend consists of Saturday and Sunday.

Sequence

Sequence is the simplest structure to show on a Warnier/Orr diagram. Within one level of hierarchy, the features listed are shown in the order in which they occur. In other words, on the diagram...

The step listed first is the first that will be executed (if the diagram reflects a process), while the step listed last is the last that will be executed. Similarly with data, the data field listed first is the first that is encountered when looking at the data, the data field listed last is the final one encountered.

When reading a diagram, the relationship between sequential features can be interpreted with the phrase "followed by" or the word "then." For example...

can be read: To make a phone call, first find a phone, then pick up the handset, then dial the telephone number.

Repetition

Repetition is the representation of a classic "loop" in programming terms. It occurs whenever the same set of data occurs over and over again (for a data structure) or whenever the same group of actions is to occur over and over again (for a processing structure). Repetition is indicated by placing a set of numbers inside parentheses beneath the repeating set, like so:

Typically there are two numbers listed in the parentheses, representing the fewest and the most number of times the set will repeat. In the example above, the set Customer Record will always occur at least once within the Customer File (in other words, there is always at least one Customer Record on the Customer File), and since the maximum number of records is never actually defined to be a specific number, we pick a letter to stand for "some number greater than or equal to 1" -- by convention the first letter of the repeating set is the letter chosen to represent the maximum.

While the minimum bound and maximum bound can technically be anything, they are most often either "(1,n)" as in the example, or "(0,n)." When used to depict processing, the "(1,n)" repetition is classically known as a "DoUntil" loop, while the "(0,n)" repetition is called a "DoWhile" loop. On the Warnier/Orr diagram, however, there is no distinction between the two different types of repetition, other than the minimum bound value.

On occasion, the minimum and maximum bound are predefined and not likely to change: for instance the set "Day" occurs within the set "Month" from 28 to 31 times (since the smallest month has 28 days, the largest months, 31). This is not likely to change, and hence it is reasonably safe to write...

And on occasion, the minimum and maximum are fixed at the same number, for instance...

In general, though, it is a bad idea to "hard code" a constant other than "0" or "1" in a number of times clause--the design should be flexible enough to allow for changes in the number of times without changes to the design. For instance, if a company has 38 employees at the time a design is done, hard coding a "38" as the "number of employees" within company would certainly not be as flexible as designing "(1,n)".

One other note...

The number of times clause is always an operator attached to some set (i.e., the name of some bracket), and is never attached to an element (a diagram feature which does not decompose into smaller features). The reason for this will become more apparent as we continue to work with the diagrams. For now, you will have to accept this as a formation rule for a correct diagram.

Alternation

Alternation, or selection, is the traditional "decision" process whereby a determination is made to execute one process or another. It is indicated as a relationship between two subsets of a set...

The Exclusive OR symbol (the plus sign inside the circle) indicates that the sets immediately above and below it are mutually exclusive (if one is present the other is not). This diagram indicates that an Employee is either Management or Non-Management...one Employee cannot be both. It is also permissible to use a "negation bar" above an alternative in a manner similar to engineering notation. The bar is read by simply using the word "not." Thus, the following means the same thing as the previous diagram.

Alternatives do not have to be binary as in the first two examples, but may be many-way alternatives. For example...

illustrates that a vehicle may be one of four mutually exclusive types. Alternatives may also be "simple"...

This data structure indicates that a special piece of data (the Overdue Notice) is present only for Overdue invoices. Otherwise, the data for an invoice is always the same.

Note that if you use the exclusive OR symbol in an alternative structure, the sets that it separates must be shown as occurring "(0,1)" times. No other number of times designation is legal when used in conjunction with the exclusive or symbol.

Concurrency

Concurrency is one of the two advanced constructs used in the methodology. It is used whenever sequence is unimportant. For instance...

indicates that years and weeks operate concurrently (or at the same time) within our calendar. The concurrency operator is rarely used in program design (since most languages do not support true concurrent processing anyway), but does come into play when resolving logical and physical data structure clashes.

Recursion

Recursion is the least used of the constructs. It is used to indicate that a set contains an earlier or a less ordered version of itself. For instance...

This is the classic "bill of materials" problem, where components contain parts and other sub-components. Sub-components also contain sub-sub-components, and so on. The doubled bracket indicates that the set is recursive.

Data structures that are truly recursive are rather rare.

  The Ken Orr Institute  

 5883 S.W. 29th St., Suite 101, Topeka, KS 66614

Phone: 785.228.1200 Fax: 785.228.1201
Email: webmaster@kenorrinst.com

kenorr@kenorrinst.com