1.3 A Case Study: Point of Sale Systems.

To assist in our understanding of the Ada 95 programming language I felt that as well as the small examples included in the text a more substantial case study should be followed through the course of the text. This case study will allow us to consider design as well as programming issues and demonstrate how many of the features of the language interact and support large scale programming efforts.

The case study itself is the development of a Point of Sale (PoS) system for a small store; not a supermarket, lets not get ambitious, which will replace some simple cash registers currently in use. Our customer has seen a catalogue of peripherals he/she can attach to a standard personal computer, via standard serial ports, which will transform it into an all-singing, all-dancing PoS Terminal (PoST).

This section will outline the requirements for this system which we will add to as we progress through the text.

1.3.1 Analysis

During discussion with our customer we have covered the functionality required of the software system to control the Point of Sale.

When started the application must detect if it is a valid time to be running, valid times being called the trading time. If it is not a valid trading time then the application will not continue.

  1. Allow for multiple users, so the user must enter their user ID and password before commencing a transaction so that the proprietor can then see which transactions were performed by which member of staff.
  2. Also allow for the possibility of more than one terminal, therefore each terminal must have a unique identifier.
  3. Keep a database of sale items, each with a price, description and department code (department codes are used to denote taxable items).
  4. To accept and log a sale transaction. A sale transaction must consist of one or more items sold, and one or more payments totalling the value of the goods sold, or if in excess then change must be given.
  5. Payment types are cash, cheque and credit cards, though more may be introduced at a later date, such as gift vouchers, so the system must be able to cope with possible extensions.
  6. The log must consist of all transactions, each item in the transaction and each payment type. The log will also consist of other important information such as users signing on or off and application events such as starting and stopping.
  7. Manage a standard set of peripheral devices, connected via either the PC’s serial or parallel ports. The peripherals identified so far are:
  1. Manage a simple user interface which allows the operator a complete view of the transaction.

The initial platform will be Windows-NT, because the proprietor is already running it for other applications they have. However the system should be designed in an operating system neutral manner so the customer can run it on a different system if the require.

1.3.2 Design

The overall design criteria are as follows.

  1. The bulk of the system should consist of a set of object-oriented abstractions which cover the major elements of the system.
  2. These abstractions should be considered as part of a library which is used then by the separate applications.
  3. The abstractions can be backup up by data files to store information between
  1. The data files are to use a common data access system, this can be written as part of the system or third part libraries can be used.
  2. The system should be made as customer independent as possible, we might like to sell it to someone else one day. This means that the customer dependant parts of the application itself should be written in one place to facilitate easy customisation.

1.3.3 Implementation

Analysis of the previous requirements led us to identify the following sets of abstractions.

  1. A set of common types, Currency, Quantity, Descriptions
  2. The system wide abstractions, Users, Terminals, Departments and Items.
  3. Trading application abstractions, tender types, transactions, promotions and the peripheral abstractions.
  4. Logging, this is to be provided as a set of abstractions which describe events to be logged.
  5. A set of support abstractions, lists and file handling for instance.

As we continue we will start to implement some of these abstractions, demonstrating how we can separate these sets into distinct libraries (using child packages) and how we can employ object oriented techniques to build hierarchies of classes (using tagged types).

For example the following is an object model diagram, using the OMT notation described in [20], of the hierarchy used to describe the peripheral objects.

Some support utilities are provided to the customer, these include:

The following is a screen shot of the application in action. It shows the point where two items have been sold and the subtotal calculated. The user is now waiting for the customer to pay.

                             Ada-Store Point of Sale
--------------------------------------------------------------------------------
+--------------------+ +-----------------------------------------+
|SUB TOTAL      £2.69| |          Welcome to Ada Store           |
|                    | |          ====================           |
+--------------------+ |                                         |
+--------------------+ |H. Baked Beans                     £0.20 |
|SUB TOTAL           | |Paracetamol 100x                   £2.49 |
| 2 ITEMS       £2.69| |                                         |
+--------------------+ |ITEMS                                  2 |
                       |SUB TOTAL                          £2.69 |
                       |                                         |
                       |                                         |
                       |                                         |
                       |                                         |
                       |                                         |
                       |                                         |
                       |                                         |
                       |                                         |
                       |                                         |
                       +-----------------------------------------+
F1------F2------F3------F4------F5------F6------F7------F8------F9------F10-----
       |       |       |Cash   |Cheque |Card   |       |       |Cancel |       |
       |       |       |       |       |       |       |       |       |       |

1.3.4 Implementation Deficiencies

The implementation provided has a number of known deficiencies and the list below presents some of these, which you may like to treat as exercises.

The source can be browsed from here.


Previous PageContents PageNext Page

Copyright © 1996 Simon Johnston &
Addison Wesley Longman