The two actions which have been introduced above, the theAnswerIs()
and the main() actions,
have been presented without a design and for actions as simple
as these this is probably acceptable. However many, if not most,
actions will be more complex than these and the production of
a design is an essential pre-requisite to their successful construction.
The design notation which will be used for actions in this book
is a modified form of Jackson Structured Programming (JSP) notation.
The JSP design for the TheAnswer
theAnswerIs() action is as follows.
The first level of this design indicates that the action theAnswerIs()
will supply a single piece of information identified as ultimate.
The double vertical lines indicate that this action is a part
of the software artefact which is currently under construction
and is not pre-supplied by Java or being reused from a previously
developed class. The second level of the design indicates that
it is implemented in a single step which obtains the answer.
The design of the UltimateAnswer
main() action is as follows.
This diagram indicates that the main action requires arguments,
although in this program it does nothing with them. The second
level indicates that it is composed of five steps each of which
produces some output, as indicated by the arrows ( => )
at the right of each step. These five steps define a sequence
which will be followed by Java from left to right. The fourth
step, identified as show the answer, makes use of an action
called theAnswerIs() to
obtain a value called ultimate
which is output onto the screen.