26. JSP Example

The four types of diagram are: Operation, Sequence, Iteration and Selection. Now consider a lottery ticket vending machine. The software for this at the highest level consists of

JSP Vending machine

In order to vend a lottery ticket, the machine must first be turned on and the software initialised to allow tickets to be issued. Once initialised, an Input operation takes place. Then an Output operation takes place that may (or may not) issue a ticket.

So this JSP diagram is immediately useful in showing the sequence of operations that will take place.

Let's expand the 'Input' operation.

JSP vending input

The input operation begins with verifying the age of the person (remember left hand boxes are first in the sequence). The JSP diagram shows a selection needs to be made as seen in the circled boxes - if the person is less than 18 years old, they should not be able to purchase a ticket, or they are over the legal age limit and can proceed.

Next the lottery numbers are input. The 'Enter number' box shows the iteration and the text alongside indicates that 6 numbers need to be entered in order to finish the Load Numbers operation.

Next let's look at the 'Output' operation

JSP Vend 3

The output operation shows a selection is to be made. If the age of less than 18 years then a message is printed explaining why a ticket can't be issued and probably returning their pound. Otherwise their ticket is printed.

Summary

The small application described above makes use of all four types of JSP diagrams in order to describe the operation of the software. Once this diagram is in place, coding the various operations can begin.

JSP diagrams are excellent for laying out a plan for software written in a procedural language.

 

Challenge see if you can find out one extra fact on this topic that we haven't already told you

Click on this link: JSP methodology

 

Copyright © www.teach-ict.com