The second major component of the structured analysis model of the system is the data dictionary. The data dictionary contains formal definitions of all the data items shown in the data-flow diagrams. If you didn't create data flow diagrams in your analysis, then in general, every data item in your solution must be included in the data dictionary. If you wrote Use Cases, then every noun that isn't an Actor is a data item or attribute. It is used to provide precise detail concerning the data entities. Importantly the dictionary items are defined as they are found in the problem domain, not in the implementation or solution domain. The items in the data dictionary will become candidates for classes in the design phase.
The data dictionary has two different kinds of
items: composite data and elemental
data.
Higher-level
(composite)
elements may be
defined
in terms of lower-level items. Elemental data are items that cannot be
reduced any further
and are defined in terms of the values that it can assume or some other
unambiguous base type.
Composite data can be constructed in three
ways: sequence, repetition, or selection of other data types.
sequence: | + |
A plus sign indicates one element
is
followed
by or concatenated with another element. |
repetition: | [ ] | |
Square brackets are used to enclose one or more optional elements. A vertical line stands for "or" and is used to indicate alternatives. |
selection: | {} {}y |
Curly braces indicate that
the element
being
defined is made up of a series of repetitions of the element(s)
enclosed
in the brackets. The upper limit on the number of allowable repetitions can be indicated by including an integer superscript on the right bracket. Here y represents an integer and indicates that the number of repetitions cannot be greater than y. |
Examples
sequence:
Mailing-address = name + address + city + zip-code
* The address at which the
customer can receive mail *
repetition:
Completed-order = [ item-ordered ]
* A complete customer order *
selection:
Atm-transaction = { deposit | withdrawal }
* An customer transaction at an
automated teller machine *
In these examples asterisks are used to
delimit the comment or verbal description of the item, but other
notations can be used as well.
ELEMENTAL DATA
Elemental data is described in terms of a data
type or by listing the values that the item can assume.
desired-temperature = floating point
*Desired-temperature is the
value the user sets for desired water temperature in the pool. It
is a floating point number in the range from 0.0 to 100.0, inclusive.
The
units are Celsius.*
age = non-negative integer
*Age is how old the
customer is in years. Age is a whole number greater than or equal
to zero.*
performances-attended = counter
*
Performances-attended
is the number of
performances this customer has
attended. Note: Since
the
person doesn't get entered into the mailing list until they have
attended a show this value can never be zero. *
counter = positive integer
*Counter is a whole number greater than zero that
can only be
incremented by
one and never
decremented.*
Formal data dictionary entries
can easily be created for more unusual sorts of data elements as well.
The example below shows how a magazine subscription system might
contain category-type
information. In this case the data items are enumerated types and the
definition lists all the allowed values. Do not create
a separate entry for each enumerated value. If necessary,
the meaning for the enumerated values can be explained in
the supplementary notes.
Transaction-Type = { Renewal | New-Subscription | Cancellation }
Transaction-Type identifies the kind of transaction.Payment-Method
= {
cash | check
| money-order | charge-card }
Payment-Method is the method by which a customer paid for their transaction. (The values should be self-explanatory).
Furthermore, details concerning input or output formats can be specified in the data dictionary. Suppose the subscription system will print a monthly report of new subscribers. In the data-flow diagram, one activity is shown that produces a data element as output, New-Subscribers-Report. In the data dictionary, the format of the report could be defined as follows:
New-Subscribers-Report = report-header + new-subscriber-list + report-summary
report-header = report-title + current-date
report-title = 'Monthly Report of New Subscribers'
new-subscriber-list = [ subscriber-name + subscriber-address ]
report-summary = 'The total number of new subscribers:' + Number-of-new-subscribers
Any non-terminal terms used in these definitions must be defined elsewhere in the data dictionary. Single quote marks are used to surround and indicate literals.
DataDictionary |
__________________________________________________________ |
name | guess count |
alias | turn count |
description | The number of incorrect guesses the player has made this game. |
definition | 0 <= guess count <= guess limit |
supplementary |
__________________________________________________________ |
name | guess limit |
alias | none |
description | the number of guesses a user is allowed before they lose the game. |
definition | guess limit = 7 |
supplementary |
__________________________________________________________ |
name | hidden word |
alias | secret word |
description | the word the player is trying to guess |
definition | hidden word = [ alphabetic character ]30 |
supplementary |
__________________________________________________________ |
name | guessed word |
alias | none |
description | the letters that the player has correctly guessed, in their proper position in the word. |
definition | guessed word = [ alphabetic character ]30 |
supplementary |
__________________________________________________________ |
name | continue choice |
alias | none |
description | whether the user wants to play again or not |
definition | continue choice = {yes | no } |
supplementary |
__________________________________________________________ |