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.
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.
- Customer Display (2x20 character LED line display).
- Cashier Display (2x20 character LED line display). The cashier might have the PC monitor on, so it is possible to reflect the cashier display in the text window where the application is running.
- Receipt printer (simple 40 column printer on continuous paper).
- Cash drawer.
- Bar-code scanner.
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.
The overall design criteria are as follows.
- Items - the things sold by the store.
- Departments - each item is part of a department which denotes some additional properties.
- Tenders - the type of money used to pay for items.
- Users - each user has some details stored about them.
- Configuration - a set of values used to configure each terminal in the system.
Analysis of the previous requirements led us to identify the following sets of abstractions.
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 | | | | | | | | | | | |
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.
Copyright ©
1996 Simon Johnston &
Addison Wesley Longman