Dave Higgins Consulting
Strategic Technology Consulting and Enterprise Architecture

Home | What's New | What's Old | Articles | Associates | Interesting Links | Cool Stuff


Section 3: Warnier/Orr Diagrams

Introduction 
Warnier/Orr diagrams are a kind of hierarchical flowchart that allows us to describe the organization of data and procedures. If you are not familiar with the diagramming form, you should take the following section of the tutorial. If you are familiar with the diagrams, feel free to skip this section.

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: 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 week end. 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 on 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.

Also, a repetitive set is defined in Brackets by typing the following as a single Brackets entry...

<set name>_`#<number of times>_`?<conditional expression>

where the "_" represents one or more required blanks. The <number of times> expression should not be enclosed in parentheses (Brackets will do that for you). The <conditional expression> is an option which is added when creating a Brackets diagram for COBOL code generation, and must be a syntactically valid COBOL boolean expression (for example: "Ideal-Customer not = Current-Customer"--Brackets will capitalize everything when it generates the code). When using the conditional expression for code generation, the only valid entries for a number of times expression are "1,n", "0,n" (where 'n' is some letter), and "0,1". When using the "m,n" form, the reserved word "Until" is optional after the question mark, and for the "0,1" form the reserved word "If" is optional after the question mark.

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 "" indicates that the sets immediately above and below it are mutually exclusive (if one is present the other is not).

You may also use the tilde character "~" as the first letter of a set name in an alternation to indicate the word "not" (as in "to be" or "not to be"). Brackets will interpret the tilde and display the set on the printed diagram with a bar above the set name (which is standard engineering notation). Brackets will also display the bar on-screen if the bracket to the right of the set is large enough, as follows...

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 which 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 some ramifications of concurrent (and conflicting) data structures will be examined later in the Physical Design part of the tutorial.

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.

Notice that the term "(recursive)" shown on the previous diagram is automatically placed on the structure by Brackets if you ever use the "Dup" feature to duplicate a set inside itself or one of it's descendants. Notice also that recursive sets should never be defined when creating COBOL programs; COBOL does not support recursive "performed" paragraphs.

Data structures which are truly recursive are rather rare, and handling them is a topic best reserved for an advanced tutorial, and will not be covered here.


Previous Section | Next Section

Home | What's New | What's Old | Articles | Associates | Interesting Links | Cool Stuff

 

This web site and all material contained herein is Copyright 2002-2009 Dave Higgins. All Rights Reserved. For additional information, please contact me at:
Dave Higgins  6215 Parkers Hammock Rd Naples, FL  34112
239-234-6033 239-234-6034 fax 816-392-4575 cell
dave@davehigginsconsulting.com
or message me on ICQ: 5168581 or AIM: HigginsD01