A Level Computing Project (OCR)

March 24, 2017 | Author: Dharmesh Tailor | Category: N/A
Share Embed Donate


Short Description

Download A Level Computing Project (OCR)...

Description

DHARMESH TAILOR Candidate Number: 6324

Centre Name: Watford Grammar School for Boys Centre Number: 17655

F454 Computing Project Hillcrest Surgery Library Database

By Dharmesh Tailor Dharmesh Tailor

0

F454 Computing Project

Table of Contents

Table of Contents

Definition ...................................................................... 3 Investigation & Analysis ................................................ 6 Nature of the Solution ................................................ 37 Algorithms................................................................... 62 Test Strategy ............................................................... 75 Software Development & Testing ............................... 83 Documentation ......................................................... 206 Evaluation ................................................................. 242

Dharmesh Tailor

F454 Computing Project

Definition

Definition Background Hillcrest Surgery is a NHS General Practice which treats patients in the London Borough of Ealing. The practice team at Hillcrest Surgery consists of trained medical staff: General Practitioners (GPs) and Practice nurses, as well as an administration team who have the responsibility of managing the day-to-day operation of the practice. The practice offers a wide range of services for its patients, primarily general medicine services but also other services such as immunisations and minor surgery. Unlike many other practices in the area, Hillcrest Surgery has a library of books. The books cover a wide range of topics and they are used by the GPs. The majority of the books are stored in the seminar room organised by subject but there are also a few books around the practice in the GPs’ rooms.

The End User

My end user is Dr. Vijay Tailor, a GP, who works at Hillcrest Surgery. He has recently been given the responsibility of keeping a record of all the books in the practice. When a new book comes into the practice, it is Dr. Tailor’s responsibility to update the paper-based file which contains details of all the books in the practice. Dr. Tailor is also a typical end user of the current library system as he regularly takes out books for use as a reference when treating patients.

The Current System

Currently, details of the books in the practice are stored in a paper-based file. All of this information is initially word-processed. It is then printed off and stored in a file. All members of staff have access to the paper-based file which is kept in the seminar room. Only Dr. Tailor has access to the word-processed file which is password-protected and stored on the practice’s network. When a new book comes into the practice, the word-processed file is updated and the new book is added to the end of the file. Like all of the other books in the file, the new book is given a unique identification number. The book is then placed in the seminar room, in the appropriate section depending on the subject of the book. The word-processed file is reprinted every month to keep up-to-date with the books in the practice and this replaces the previous records in the paper-based file. GPs can also take out books from the Seminar Room. The books are then stored in their own rooms. To do this, there is a pre-printed loaning sheet in which the GP writes the details of the book and their name. It is then Dr. Tailor’s responsibility to update the location of the book in the word-processed file.

Data required

The data required by the end user for every book is: • Identification number • Title • Author • Category • Location

Dharmesh Tailor

3

F454 Computing Project

Definition

Data Inputs Item of data

Description

Type

Source

ID No.

Each book is assigned a unique identification number e.g. 15 The title of the book e.g. Lecture Notes on Infectious Diseases The author of the book e.g. Warin Each book is assigned a category based on the subject of the book e.g. Infection The location of the book e.g. Seminar room

Integer

Dr. Tailor

Text Text

From the book Dr. Tailor

Title Author Category Location

Text

Text

Processes • • • •

From the book

From the pre-printed loaning sheet

Adding book records Editing book records Deleting book records Updating location of books

Outputs Output

Book Details

Description

List of books and their respective information. The information stored about each book is: ID No, title, author, category and location.

Format

Hard copy

Problems with the Current System

The main problem that Hillcrest Surgery faces with the current system is that when the GPs take out books from the Seminar Room, they do not always record the books being taken out on the loaning sheet. Books can get lost whilst being held in the GPs’ rooms and overtime this has left the word-processed file out of date as there are records of books in the file, which are no longer available in the practice. Another problem is that when GPs want to look for a book, they have to look through the entire file and this can be quite time consuming. In addition to this, editing the information about a specific book has become increasingly difficult over the years due to the large number of books in the file.

Solution to the problem

A new computerised system would solve all of the problems of the current system. This new system would take the form of a database with the ability of storing the records of all the books in the practice. A lot of time would be saved, as many of the processes of the existing system would be completed much more quickly and they would require minimal input from the user. In addition, a computerised output of the book records can easily be produced for the user as well as the production of a hard copy, which can be stored in the paper-based file. Searching for a particular book will also be much easier as the new computerised system would be able to search and sort books by a specific field.

Dharmesh Tailor

4

F454 Computing Project

Definition

Letter from End User – 12/09/11

Dharmesh Tailor

5

F454 Computing Project

Investigation & Analysis

Investigation & Analysis Following my initial research into the current system, I have come to the conclusion that the current system needs to be replaced from a paper-based system to a computerised system. Despite knowing much about the theory and practice of the current system, I still need to find out more information regarding the nature of the output and the way it is handled and also what type of computerised system would be the most appropriate to the surgery. This includes details such as who currently uses the existing system and what their level of ICT is. In order to decide upon the type of computerised system I must produce, it is essential that I investigate further and find out for myself the problems the current system faces. I also need to find out the hardware and software specifications the computerised system will run on.

Investigation Plan

I intend to gather information from a variety of sources, however before I begin to plan my investigation I will weigh the advantages and disadvantages of the various methods of factfinding. This will allow me to select the most appropriate methods for my investigation. Interview

Questionnaire

Group meeting

Advantages

Disadvantages

This will allow my end user to talk at length but will also allow me to leave a prepared script so that any interesting or unprepared responses can be followed up. This will allow me to find out the views of a large number of staff very quickly.

As interviews are quite time consuming, this will restrict the number of staff whose views can be sought.

This will allow a large number of people to discuss points and make their views known. In addition, this will save time compared with conducting an interview. Observing the This will allow me to see first-hand current system the problems facing the current system. Collecting This will allow me to find out what documentation data is required by the system and in what form the information is output.

Dharmesh Tailor

As the questions are predetermined, the staff supplying the answers may find difficulty in putting their points of view across. One or two people tend to dominate in a group meeting and this may not allow all members of the group to give their opinions. As my end user knows that he is being observed, he may not behave in a normal manner. Not all of the documentation may be available or may be confidential.

6

F454 Computing Project

Investigation & Analysis

I have decided that the methods of fact-finding that would be most appropriate to my investigation are: interview, questionnaire, observing the current system and collecting documentation from the current system. Due to time constraints, I will only interview my end user, Dr. Tailor, but I will obtain information from the other users of the current system via a questionnaire. My reason for not going ahead with a group meeting is that I would be able to obtain the same information from an interview with my end user and from the questionnaire. In addition, it is highly unlikely that I would be able to arrange a meeting with all users due to the busy nature of the practice. To save time, I will try to arrange the observation of the current system on the same day as the interview however this is subject to permission from my end user.

Interview

I have arranged an interview with Dr Tailor for the 16th of September at Hillcrest Surgery and from this interview I hope to clarify the current inputs and outputs. In addition, I hope to find out more information concerning the operating environment – this includes details such as the type of people who will be using the computerised system, their level of ICT, and the hardware and software that the computerised system will run on.

I intend to use a voice recorder application on my phone to record the interview since this will make it easier to take down my end user’s responses. More importantly, I will be able to consider the responses given to the questions so that any interesting or unexpected responses can be followed up. As the interview will be recorded, I will ask my end user’s permission beforehand. Below is a copy of the email I sent to Dr. Tailor regarding whether I could record the interview and collect documentation from the current system. I also asked whether I could observe him as the end user of the current system.

Email from End User – 14/09/11

Dharmesh Tailor

7

F454 Computing Project

Investigation & Analysis

Interview Preparation From the interview, I want to gain some insight into the following areas: 1. The volume of data to be stored 2. How often the data changes? 3. What data is stored? 4. The form of output

5. The processes involved 6. The time constraints

7. The problems of the current system 8. Requirements of the new system 9. Operating Environment

10. The constraints on hardware

11. The IT skill level of users

Initial Questions

The following questions were planned before the interview, based on the above areas, in order to have a basic idea of the direction of the interview. I have planned starter questions on each of the areas as well as a series of follow up questions that are dependent on the answers given to the starter questions.

The following questions concern the current system - the inputs, the outputs and the processes. 1. How many books are there in the practice? 2. How often do you receive new books? •

Follow-up question: How many new books do you receive every (time period

based on starter question)?

3. What information is currently kept about each book? 4. Do you have more than one copy of certain books? 5. How do you store the information at the moment?

6. What would happen if a book is taken out of the seminar room?

7. In what form is the information output? 8. Who currently use the system?

The following questions concern the new system.

1. What are the major problems with the current system that you would like the new system to address?

2. Are there any features of the current system that you would like to retain?

Dharmesh Tailor

8

F454 Computing Project

Investigation & Analysis

3. Are there any extra features you would like the new system to do? 4. What other information would you like to store about each book?

5. When would be the best time to put the new system into operation?

The following questions concern the operating environment – the people, the hardware, the software. 1. Who will be likely to use the new system?

2. What is the computer literacy of the average user?

3. What type of computers are used – desktops or laptops?

4. Are the computers in the surgery running on a network? •

Follow-up questions:

If YES: Would you like the new system to be installed onto the network or

installed onto a specific computer?

If NO: Which computer would you like the new system to be installed on?

5. What operating system are the computers in the surgery running on? 6. What size monitors are used?

7. What types of printers are used?

Dharmesh Tailor

9

F454 Computing Project

Investigation & Analysis

Transcript The following interview was conducted on the 16th of September 2011 between me, Dharmesh Tailor, as the Systems Analyst and my end user, Dr Vijay Tailor, General Practitioner at Hillcrest Surgery. Dharmesh: Good afternoon, Dr. Tailor. Thank you for allowing me to conduct this interview. Dr. Tailor: That’s OK.

Dharmesh: My first question is how many books are there in the practice?

Dr. Tailor: I would imagine that there are approximately 400 books. Dharmesh: And how often do you receive new books?

Dr. Tailor: Well, we originally agreed in our practice that we would try and purchase one book per month. I must admit that over the last year we haven’t been doing that. However, as we are going to be training junior doctors again, we are going to try and start purchasing one book per month.

Dharmesh: What information is currently kept about each book, just to confirm the data inputs we discussed in our initial meeting?

Dr. Tailor: Every book has a unique Book ID which is just a number from 1 to 400. This number is recorded on the margin and it makes it easier to find a book. Every time we get a new book, its Book ID is calculated by increasing the previous book’s Book ID by 1. We also store the title, author, category and the room in which the book is stored. Dharmesh: Do you have more than one copy of each book?

Dr. Tailor: We usually retain only one copy of each book in the practice and any extra copies we receive are donated to other practices in the area.

Dharmesh: I know we already discussed this in some detail in our initial meeting but how do you store the information about the books at the moment?

Dr. Tailor: The information about the books is stored in a word-processed file on the practice’s network. The file is password-protected and we print off the file every month and this is stored in a paper-based file. Dharmesh: What would happen if a book is taken out of the seminar room?

Dr. Tailor: To be honest, for the last few years we haven’t been recording when a book has been taken out of the seminar room. This has left the practice library file out of date and for many of the books we do not know where they are currently being stored. As we have previously discussed, a GP taking a book out would write their name on a sheet and the book being taken out. The location of the book would then be updated on the library file.

Dharmesh: In what form is the information output?

Dharmesh Tailor

10

F454 Computing Project

Investigation & Analysis

Dr. Tailor: The word-processed library file would be printed off and stored in a file; however we haven’t updated or printed out the file for a while now. Dharmesh: Who currently updates the records?

Dr. Tailor: Originally, it was one of the doctors in the practice, Dr. Spencer, and he kept a catalogue of the library books. However, this responsibility has since been passed to me. Dharmesh: And who actually takes out books to read?

Dr. Tailor: Only GPs are allowed to take out books from the seminar room to their own rooms however any member of staff is able to take a book out of the shelf and read it in the seminar room. Dharmesh: I will now ask you a few questions concerning the new system. What are the major problems in the current system that you would like to address in the new system?

Dr. Tailor: The major problem at the moment is that a lot of the books are not catalogued or indexed. The library file at the moment is also out of date so we do not know which books we actually have in our practice. Another problem we have is that a lot of the books are scattered throughout the practice in different consulting rooms and this means that we do not know the whereabouts of many of the books in the practice. Dharmesh: Is there anything else you would like the new system to do?

Dr. Tailor: I want the new system to be as simple as possible where I would be able to click on the program, take out a book and I be assured that it has been recorded on the database. It also needs to be easily accessible and user-friendly so that everyone can be able to use it. Dharmesh: In addition to the book ID, title, author, category and room fields, what other information would you like the new system to store?

Dr. Tailor: It would be a good idea for the new system to store the ISBN and publisher of every book. Perhaps also a format field which indicates whether a book is hardback or paperback. Dharmesh: When would be the best time to put the new system into operation?

Dr. Tailor: I don’t think it really matters what time the new system is put into operation, just when it is feasible.

Dharmesh: The questions I am going to ask now concern the operating environment. My first question is who will be using the new system? Dr. Tailor: It will primarily be the doctors in the practice but may also be other doctors such as GP registrars and F2 doctors who are with us for more than a few months. All doctors, however, including those training at the practice, have access to the books. Dharmesh: How computer literate are the doctors that will be using the new system?

Dr. Tailor: In our practice, we use a system that stores patient records so all the doctors are familiar with computers and how to use them. There isn’t anybody in the practice who would

Dharmesh Tailor

11

F454 Computing Project

Investigation & Analysis

have difficulty using the new computerised system. Regardless of this, when we employ staff we make sure that they have a good knowledge of IT. Dharmesh: In the practice, what type of computers are used – laptops or desktops?

Dr. Tailor: All the computers in the practice are desktops. Dharmesh: Are the computers running on a network?

Dr. Tailor: They are all running on a network but you are able to access the individual operating systems on the computers.

Dharmesh: Would you like the new system to be installed on the network or installed on a specific computer?

Dr. Tailor: I thought it would be better to have the new system installed on the desktop in the seminar room. My reason for this is that I am not sure the doctors will access the system from the computers in their room. It may also lead to problems as we have experienced in the past when installing programs on the network. Dharmesh: What operating system is the computer in the seminar room running on?

Dr. Tailor: The computers in the practice are all running on Windows XP. Dharmesh: What size monitor is the computer in the library?

Dr. Tailor: I believe the monitor is either 18” or 19”. After this interview, you will have the opportunity to find out more information about the computer. Dharmesh: What printer is the library computer connected to?

Dr. Tailor: As there is no printer in the seminar room, the desktop is not directly connected to any printer however you are able to print to any of the printers on the network. There is in fact a printer on the same floor as the seminar room that you would be able to print to. You will have the opportunity to find out more. If you need any help, don’t be afraid to ask myself or any member of staff.

Dharmesh: Thank you for your time, Mr Tailor. I just wanted to know if I have permission to take photographs of the operating environment and take any documentation from the current system. Dr. Tailor: Yes, that should be fine.

Dharmesh Tailor

12

F454 Computing Project

Investigation & Analysis

Analysis of the interview The interview with my end user has given me a clearer understanding of the current system. There are approximately 400 books in the practice and the practice receives one new book per month. This means that the new system must be able to store the records of 400 books currently in the practice. In addition to this, the new system must be able to store the records of new books entering the practice every month.

The inputs of the current system are: Book ID, Title, Author, Category and Room. The Title, Author and Category inputs are obtained from the book itself and the Room input is specified by the user. The Book ID input is unique for every book record and is calculated by incrementing the last record’s Book ID by 1. In the new system, it has been decided to include the fields: ISBN, Publisher and Format in addition to the fields of the existing system. The records are entered into a word-processed file and the file is stored on the practice’s network. As the file is password-protected, I may implement some form of security in the new system to prevent unwanted access to the records. The word-processed file is printed every month; it is therefore essential that one of the outputs of the new system is a hard copy report.

All new books are stored in the seminar room until they are taken out. Only GPs are allowed to take books out of the seminar room. In order to take a book out, the GP would have to write the book’s details as well as their name onto a pre-printed loan sheet. Dr. Tailor would process the data on the loan sheet at the end of every week by replacing the location of the book with the room of the borrowing GP. In the interview, my end user said that the current system of dealing with the loans was very inefficient and led to books being scattered around the practice with no record of their location. It is therefore important that the new system is intuitive to use so that the location of all books is recorded. It will be only the GPs who will be able to take books out of the seminar room. The new system therefore needs to be user-friendly and accessible. As identified in the interview, all the GPs are familiar with computers and various software packages so they should not have any problem in using the new system. My end user has requested for the new system to be installed on the desktop computer in the seminar room. The computer is running on Windows XP and the monitor is either 18” or 19”. There is a printer in the room opposite to the seminar room where the reports can be printed. I will confirm the hardware specifications in my observation session.

Dharmesh Tailor

13

F454 Computing Project

Investigation & Analysis

Questionnaire I have decided to conduct a questionnaire that will be completed by all of the doctors in Hillcrest surgery. The questionnaire will focus on the doctors’ opinions of the current system but also on their opinion about investing in a new computerised system. From the questionnaire, I want to know how often they take books out of the library and any features that they think should be included in the new system. I have designed the questionnaire electronically so that I can email the questionnaire to all the doctors and they can email the completed questionnaire back to me. Below is a copy of the questionnaire:

Hillcrest Surgery Library System Questionnaire Name: How often do you take out books from the library? Please select one option Daily Weekly Monthly Never

How efficient is the current paper-based method of storing details of the books in the library? Please select one option Very Adequately Moderately Poorly

How computer literate are you? Please select one option Very Adequately Moderately Poorly

Would investing in a computerised library system help the practice greatly? Please select one option Yes No

Are there any additional features that should be included in the computerised library system? Please write your answer in the space below.

Dharmesh Tailor

14

F454 Computing Project

Investigation & Analysis

Questionnaire results

Dharmesh Tailor

15

F454 Computing Project

Investigation & Analysis

How computer literate are you?

Very 43% Adequately 57%

Dharmesh Tailor

16

F454 Computing Project

Investigation & Analysis

Are there any additional features that should be included in the computerised library system? 1. User friendly interface 2. Password protected

3. A way of sorting the records by different fields 4. A loaning feature

5. A way of searching for books

6. Intuitive, easy to use system 7. Easy to maintain

8. Doesn’t take up many resources 9. Ability to print reports

Dharmesh Tailor

17

F454 Computing Project

Investigation & Analysis

Sample questionnaire Hillcrest Surgery Library System Questionnaire Name: Dr Vijay Tailor

How often do you take out books from the library? Please select one option Daily Weekly Monthly Never

How efficient is the current paper-based method of storing details of the books in the library? Please select one option Very Adequately Moderately Poorly

How computer literate are you? Please select one option Very Adequately Moderately Poorly

Would investing in a computerised library system help the practice greatly? Please select one option Yes No

Are there any additional features that should be included in the computerised library system? Please write your answer in the highlighted space below.   

Robust system to search titles

System to identify which books have been loaned and by whom

User friendly interface for adding books to the database so that staff who have little IT experience can use it with ease

Dharmesh Tailor

18

F454 Computing Project

Investigation & Analysis

Analysis of questionnaire I was fortunate to receive completed questionnaires from all seven of the GPs. As I expected, the results were largely similar with the exception of one GP who answered 'No' to the question about whether investing in a computerised library system would help the practice greatly. I included that question to find out whether or not I had the support of the majority of GPs in the practice and clearly from my results I do. From this day forward, I can be certain that the computerised system will be beneficial for the practice. The question: 'how often do you take out books from the library?’ produced some interesting results. The majority answered 'monthly' followed by 'weekly' and only one person answered 'never'. My end user did say that not all of the GPs take books out. It is assuring that the majority of the GPs will definitely be using the computerised system at least once per month. The purpose of the question about the efficiency of the current system was to find out the GPs' opinions of the current system. On the whole, the results agree with Dr. Tailor's view of the current system with over half of the GPs answering 'poorly'. Two GPs answered 'moderately' and one GP answered 'adequately'. Nobody answered ‘very’ for this question, which indicates that there is not even one GP who feels fully satisfied with the current system. I put in the question about computer literacy to find out whether the GPs would feel comfortable in using a new computerised system. All the GPs answered either ‘very’ or ‘adequately’, which indicates that they should not have any problem in using the new system.

The last question required a written response and the purpose of it was to find out the sort of features the GPs expected the new computerised system to have. There was much emphasis on the new system being user friendly, intuitive and easy to use. More importantly, the GPs wanted a system that would be able to sort books by field, the ability to loan books and search for a particular book and lastly to print reports. An interesting response given was for the new system to be password protected since the word-processed library file of the current system was also password protected.

Dharmesh Tailor

19

F454 Computing Project

Investigation & Analysis

Observation of the current system On the 16th of September, I went to Hillcrest Surgery in order to undertake an observation of the current system and the way it is run. My aims for the observation session are: 

 

To observe the way in which the data is currently processed in the current system.

To confirm the data inputs and outputs and to obtain documentation - this will provide evidence for the outputs of the current system. To establish the hardware and software specifications of the desktop computer in the seminar room – the new computerised system will be installed on this computer.

To follow are my results from the observation:

The Current System

The following are the notes I made when observing Dr Tailor: 

   



My end-user enters the information required for each book on a word-processed file. A template is used which contains the fields for the book ID, title, author, category and location of the book. The file is password protected.

New books are added to the end of the file and the book is assigned an ID that is 1 more than the ID of the previous book. The file is printed out and stored in a folder.

A pre-printed loaning sheet is used by the GPs to take books out of the seminar room. The GP would write the details of the book being taken out (book ID, title, author and category) as well as the new location of the book. The location of the book would then be updated in the library file.

Hardware and Software

The following are the hardware and software specifications of the desktop computer in the seminar room. 

   

The desktop computer in the seminar room is a Dell OptiPlex GX520 running Microsoft Windows XP service pack 2. The monitor is a 17” Dell E173FP which has a resolution of 1024 x 768 pixels. The keyboard is a Dell RT7D60 Smartcard USB keyboard. The mouse is a Microsoft basic optical mouse.

The main printer on the same floor as the seminar room is a Canon imageRUNNER 2270 (iR2270).

Dharmesh Tailor

20

F454 Computing Project

Investigation & Analysis

Images The desktop computer in the seminar room running Microsoft Windows XP, with a 17” monitor, keyboard and mouse:

The file used to store the records of the books in the practice:

Dharmesh Tailor

21

F454 Computing Project

Investigation & Analysis

The computer specifications of the desktop computer:

Analysis of specifications • • • • • •



Intel Pentium 4 Processor (2.80 GHZ) – This is a fairly modern processor that should be fast enough to run any program I create.

1 GB RAM – This is a reasonably high amount of RAM so the program should run smoothly.

37.24 GB Hard Disk Drive – This hard drive is large enough to store the program and its records. 4 USB Ports – This means that installation can be done from a USB Disk Drive.

DVD Drive – This means that installation can be done from a CD Disk Drive.

Microsoft Windows XP Professional Operating System – The program needs to be compatible with this operating system. This is fine as the majority of software development will be done on this operating system. Dell 17” Monitor – Development of the solution needs to be done with the given resolution of 1024 x 768 pixels in mind.

Dharmesh Tailor

22

F454 Computing Project

Investigation & Analysis

Collecting Documentation Below is a sample document taken from the library file.

This will be used as a template for how the hard copy report (output) should be presented:

Dharmesh Tailor

23

F454 Computing Project

Investigation & Analysis

Below is a sample document taken from the library file.

It is the index page of the file and displays the various categories:

Dharmesh Tailor

24

F454 Computing Project

Investigation & Analysis

Below is a sample loan sheet taken from the seminar room in Hillcrest Surgery:

Dharmesh Tailor

25

F454 Computing Project

Investigation & Analysis

Flowchart of the Current System The flowchart below illustrates how the current system works and the way in which the data is inputted, processed and outputted.

Dharmesh Tailor

26

F454 Computing Project

Investigation & Analysis

Identification of prospective users At this stage, I have now established that the end users of the new computerised system will be the general practitioners (GPs) at Hillcrest Surgery. This means that the system can be made to specifically suit their needs and their computing ability.

Also at this point I have decided to establish, based on my investigation, some general objectives that the new system needs to fulfil in order to meet the needs of the end users. Input Objectives Book Details        

Book ID Title

Author

Category Room ISBN

Publisher Format

Processing Objectives   

Calculate the Book ID of a new book

Sort by Book ID, Title, Author and ISBN Search for book

Output Objectives  

On-screen report

Hard-copy report o o o

List of all books

List of books in each category List of books in each room

Dharmesh Tailor

27

F454 Computing Project

Investigation & Analysis

Appraisal of feasibility of potential solutions In order to decide the best way to produce the new system for Hillcrest Surgery, I must consider the feasibility of several different packages and methods I could implement to get the desired solution. I will do this by taking a selection of sensible packages available and weigh their advantages and disadvantages until the method best suited to my end user is found. The typical solutions are: a spreadsheet software package, a database software package and a bespoke Delphi application.

Table of Comparisons Solution Spreadsheet Database Bespoke program

Program Microsoft Excel Microsoft Access Lazarus

Price (approx.) £60 £100 Free

Experience Required Novice Medium Advanced

Spreadsheet software package – Microsoft Excel Advantages:   

Simple processing e.g. multiplying, adding, subtracting can be done very easily.

Outputs can be produced e.g. charts, diagrams which can be useful when presenting data.

VBA (Visual Basic for Applications), Excel’s own programming language, gives greater control over user actions and processing logic and also allows forms to be designed

 

providing a user interface.

Data types do not need to be directly expressed therefore no work is needed to decide how the data is to be defined.

Data lengths do not need to be specified for text or numeric types. Therefore, the lengths

of the variables do not need to be initially expressed giving more freedom on how long

     

the data you input is.

Numeric tables and look-up lists can be used as tools for validation.

Sorting and searching data is available through the use of a database table. Complex Boolean searches are possible.

Macros can be used to automatically perform advanced processing and querying of the data.

Security features can be used to restrict access for certain users, e.g. make some fields read-only.

The program is unlikely to have bugs and Microsoft have support teams if problems arise when my end-users use the system.

Dharmesh Tailor

28

F454 Computing Project



Investigation & Analysis

My end user has some familiarity with spreadsheet software package, mainly Microsoft Excel.

Disadvantages: 

Excel was not built to facilitate the creation of databases but rather for calculations and production of charts. Although Excel has database facilities, this is not its primary

        

function.

No primary key function therefore records do not have a unique identifier which may lead to problems when handling the data.

Forms cannot easily be created without using VBA because there is no form wizard. Therefore, programming in Visual Basic would be necessary.

The use of VBA would involve a similar amount of time as programing a bespoke Delphi application.

Only a low level of security features are offered by spreadsheet packages which means it would not be possible to implement a password feature. No Boolean data types e.g. True/False

Data lengths are not specified therefore there is little control over how much memory will be used.

Recording macros for complex actions such as queries and linking them to buttons on the spreadsheet can be clumsy.

No underlying SQL so queries cannot be changed to match advanced requirements. Formatted output reports cannot be produced from queries.

Database Software Package – Microsoft Access Advantages:     

Easier to create a database because Microsoft Access is designed to handle data. Options to design tables, forms, queries and reports.

‘Wizards’ are at hand to make the process of creating a database much easier. They also allow for automated design.

Database can be easily customised or tweaked.

Broad range of data types such as numeric (byte, integer, long integer, currency, single

precision floating point, double precision), text, date, time, look-up list or table, Boolean



(Yes/No).

A range of validation routines are available for fields and inputs. This is provided by the

expression builder.

Dharmesh Tailor

29

F454 Computing Project

         

Investigation & Analysis

Length of text fields can be specified to save disk space but also to restrict entry by user. Primary key is specified for each record which means that there is little excess data.

Forms can be customised and additional controls such as buttons can be added to perform macros.

Reports can be produced from the data and launched as macros from buttons. The reports can also be customised and based on only a selection of fields or records. Queries can be created using either a wizard or a custom design form.

Queries can be saved for future use e.g. the queries can be launched as macros from buttons on forms.

Fields can be sorted in a query and the sorts can be nested.

The application, Microsoft Access, can be customised to reduce its complexity by removing menus and options.

Access to different users can be restricted through the use of security features.

Visual Basic of Applications (VBA), Microsoft Access’s own programming language, can be used for greater control over user actions and processing logic.

Disadvantages: •

Calculations on the data can be performed however this is less intuitive than in a



spreadsheet.



be difficult and time-consuming for an inexperienced user.



program in Lazarus in free.



programming a bespoke program in Lazarus.

Reports, forms and queries have to be created and customised by the end-user. This can Purchasing a new software package would cost money when creating a bespoke Any use of Visual Basic for Applications (VBA) would involve a similar amount of time to The end user would be required to create the record structure in Access whereas the programmer would create that in a bespoke Delphi program.

Bespoke Delphi Program – Lazarus Advantages:   

The programmer is in control of the way the data is inputted, processed and outputted and the system can be made to meet the end user’s needs exactly.

The programmer has the ability to design the user interface and guide the user into entering the required data.

Any use of the data in calculations can be programmed into the system and this would

Dharmesh Tailor

30

F454 Computing Project

   

Investigation & Analysis

not require any use of Query language.

Data can be inputted in many different ways. The most suitable methods of input would be through the use of edit boxes and combo boxes.

The format of the output can be specified by the programmer. A print routine can be written which produces a hard copy output of the records.

Development using Lazarus follows Rapid Application Development (RAD) where the user guides development of the system.

Links can be made to integrate features of Access and SQL within the application.

Disadvantages:   

The forms and record structure would have to be programmed from scratch and would not be based on an existing database or spreadsheet software package.

This is the most time consuming solution out of all the others.

The solution requires expert knowledge of programming in Delphi, more knowledge is

required than creating a database in Access or a spreadsheet in Excel.

Justification of Chosen Solution

My chosen solution is the bespoke Delphi program developed using the Lazarus Integrated Development Environment. My reason for this is that I have full control over the input, output and processing of the data along with the design of the user interface. This means that the solution will meet the end user’s requirements as closely as possible. At the end of development, the solution is compiled and the end result is an executable application, which can run on all Windows computers including the desktop computer in the Seminar room. This will lower the costs for Hillcrest Surgery as additional software will not be required to run the application and as the Lazarus IDE is a free, open-source platform, there are no start-up costs. Although this would require more time than developing solutions using the other software packages, the bespoke program would be tailor made to solve the specific problem. In addition, with a bespoke program, the user can specify the calculations needed and the format of the output.

Dharmesh Tailor

31

F454 Computing Project

Investigation & Analysis

Hardware Specification The desktop computer in the Seminar room has fairly up-to-date hardware specifications. This means that any upgrades to the computer will not be necessary as the computer is capable of running the program. The desktop computer in the Seminar room has the following specifications:       

Intel Pentium 4 Processor (2.80 GHZ) 1 GB RAM

37.24 GB Hard Disk Drive 4 USB Ports DVD Drive

Microsoft Windows XP Professional Operating System Dell 17” Monitor

The end user has access to the following input devices: 



Dell RT7D60 USB Keyboard – This is a standard, wired keyboard used throughout Hillcrest Surgery.

Microsoft Basic Optical Mouse – This is a standard, wired mouse used throughout

Hillcrest Surgery.

Data will be inputted into the system via the above input devices. Other methods of input, e.g. video or audio input, will not be necessary. The end user has access to the following output devices: 

Dell E173FP 17” Monitor – This monitor has a maximum resolution of 1280 x 1024 pixels however the resolution is currently set to 1024 x 768 pixels. The program and any



on-screen output must support this resolution.

Canon imageRUNNER 2270 Printer – Any hard-copy output will be printed via this printer.

Dharmesh Tailor

32

F454 Computing Project

Investigation & Analysis

Hardware Requirements The new system must cater for: • •

Inputting data with a keyboard otherwise the user will not be able to enter records.



records.

• •

Selecting data with a mouse otherwise the user will not be able to navigate between

Outputting data on a monitor otherwise the user will not be able to view records or reports.

Printing data through a black and white laser jet printer otherwise the user will not be able to print reports.

Should be able to run on a PC with: o

o o •

Intel Pentium 4 Processor (2.80 GHZ) otherwise the computer will not process data within the system.

1 GB RAM otherwise the system will be too slow to run.

37.24 GB hard disk space otherwise records cannot be saved to file.

Support a resolution of 1024 x 768 pixels otherwise the system will not be displayed properly.

Software Requirements The solution must run on a computer running Windows XP Professional Operating System. The majority of testing and software development will be done using this operating system. In addition, the end user will need access to software packages capable of viewing .PDF and .TXT file formats. I have been assured by the end user that the computer has software capable of this already installed. The new system must cater for: •

Microsoft Windows XP Professional Service Pack 2 otherwise the application will not run on the desktop computer in the seminar room.

Dharmesh Tailor

33

F454 Computing Project

Investigation & Analysis

Input, Output and Processing Objectives Input Objectives

Book ID

Title Author Category Room

Processing Objectives

ISBN Publisher Format Comments (This field was added after end user feedback – see Design section) Calculate Book ID

Sort books Search for book Output Objectives

On-screen report

Hard copy report

Dharmesh Tailor

Unique identifier for each book The title of the book The author of the book The category of the book, based on its subject The room where the book is currently being stored The ISBN of the book The publisher of the book The format of the book Any extra information or issues about the book can be inputted here.

Calculation of the Book ID by increasing the Book ID of the previous record by 1. If no records exist in the Database then the record is assigned a Book ID of 1. Sorts the book records by Book ID, Title, Author and ISBN. Search for books by entering a Book ID, Title, Author or ISBN. On screen report displaying a table of books sorted by Book ID, Title, Author or ISBN. The table can be filtered by Category and Room fields. Table of all the books in the database or the books in each category or room. The hard copy report is a printout of the on screen report and can be customised.

34

F454 Computing Project

Investigation & Analysis

General Requirements 1. The system needs to store the information of at least 400 books in the library database.

2. The system needs to automatically assign every new book a Book ID. 3. The system needs to cater for all the different types of books. 4. The system needs to cater for all the different categories.

5. The system needs to store the location of the books.

6. The system needs to sort books by Book ID, Title, Author and ISBN.

7. The system needs to search for books by entering a Book ID, Title, Author or ISBN.

8. The system needs to output the records to a table onscreen.

9. The system needs to produce a hard copy report formatted similarly to the report acquired during the observation of the current system.

10. The system needs to be secure enough to prevent anyone but the GPs from accessing it.

11. The system needs to be intuitive with a simple interface so that it is accessible for end users with limited experience in IT.

Dharmesh Tailor

35

F454 Computing Project

Investigation & Analysis

Letter from End User – 25/09/11

Dharmesh Tailor

36

F454 Computing Project

Nature of the Solution

Nature of the Solution Overall System Design The book database system will be written using the Delphi programming language in Lazarus. This will compile the project and produce an executable application that can be executed on my end user’s computer. The system will feature an intuitive menu system and onscreen help hints to help the user navigate through the system. The onscreen hints will appear when the user moves his/her mouse over an item they are not sure about. In addition to this, there will be a user guide, which the user will be able to access from the main menu. The onscreen help hints and the user guide will form the basis of the system’s help capabilities.

There will be a data capture form, which will have all the fields that Hillcrest Surgery requires. The fields can be saved to form a record, which can then be edited, or the entire record can be deleted. Furthermore, the user will be able to navigate through the database by searching for books by the Book ID field. There will also be a secondary form in which the records will be displayed in a table. There will be a sorting feature where the user can organise the records by field as well as a search function so that the user can locate a particular record. Highlighting a record in the table will display the record in the data capture form.

Modular Structure of System Top Tier

Library Database System Manage Book Data

Dharmesh Tailor

Manage Book Table

37

F454 Computing Project

Nature of the Solution

Second Tier

Dharmesh Tailor

38

F454 Computing Project

Dharmesh Tailor

Nature of the Solution

39

F454 Computing Project

Nature of the Solution

Data Flow Diagrams Level 0 Context Diagram

Dharmesh Tailor

40

F454 Computing Project

Nature of the Solution

Level 1 Diagram

Dharmesh Tailor

41

F454 Computing Project

Nature of the Solution

Level 2 Diagrams

Dharmesh Tailor

42

F454 Computing Project

Dharmesh Tailor

Nature of the Solution

43

F454 Computing Project

Nature of the Solution

Definition of Data Requirements Record Structure – Library Database Item Book ID

Data Type Integer

Title

String[40]

Author

String[20]

The author of the book.

Category

String[20]

Infectious Diseases

ISBN

String[13]

A category is assigned to every book depending on the subject of the book. The ISBN of the book.

Publisher

String[20]

The publisher of the book.

Oxford

Format

String[15]

Paperback

Room

String[20]

The format of the book.

Comments (This item was later included after end user feedback)

String[255]

Dharmesh Tailor

Description The unique identification number assigned to each book (the key field), which is used to identify a book. The title of the book.

The room where the book will be stored. Any key issues that need to be raised about the book can be recorded here.

Typical Data 5

Source of Data This will be designated by the program.

Oxford Handbook of Infectious Diseases Estee Torok

This will be read directly from the book and inputted by the end user. This will be read directly from the book and inputted by the end user. This will be decided and inputted by the end user.

978365987612

Dr. Dhatt’s Room

Please check for CD.

This will be read directly from the book and inputted by the end user. This will be read directly from the book and inputted by the end user. This will be decided and inputted by the end user. This will be decided and inputted by the end user. This will be decided and inputted by the end user.

44

F454 Computing Project

Nature of the Solution

Validation I will be incorporating a wide range of validation techniques to prevent any errors from occurring and to ensure all the data that my end user inputs is valid. The different validation techniques I will be using are: •





Presence check – This will test whether any data has been entered into the field. Blank fields will not be accepted. Type check – This will test whether the data entered into the field is of the correct type. For example, letters will not be allowed in a numeric field.

Length check – This will ensure that the field does not exceed a certain number of characters. For example, the ISBN field should not have more than 13 characters and so a 14th character will not be allowed.

I will make use of dialogue boxes, beeps and the highlighting of fields to inform my end user of the errors. Field

Table

Validation

Error Message

Title

Book Table

N/A

Title

Book Table

Type check (only letters, numbers and spaces are allowed) Presence check

Author

Book Table

Type check (only letters and spaces are allowed)

N/A

Author

Book Table

Presence check

Author missing.

Category (This was later removed after end user feedback)

Book Table

Type check (only letters and spaces are allowed)

N/A

Dharmesh Tailor

Title missing.

Format of Error Message The key is not allowed to be entered and an error beep is produced. A dialogue box is displayed and the field is highlighted red. The key is not allowed to be entered and an error beep is produced. A dialogue box is displayed and the field is highlighted red. The key is not allowed to be entered and an error beep is produced.

45

F454 Computing Project

Nature of the Solution

Category

Book Table

Presence check

Category missing.

ISBN

Book Table

Type check (only numbers are allowed)

N/A

ISBN

Book Table

Length check (only 13 digits are allowed)

N/A

ISBN

Book Table

Presence check

ISBN Missing.

Publisher

Book Table

Type check (only letters and spaces are allowed)

N/A

Room (This was later removed after end user feedback) Room

Book Table

Type check (only letters and spaces are allowed)

N/A

Book Table

Presence check

Room Missing.

A dialogue box is displayed and the field is highlighted red. The key is not allowed to be entered and an error beep is produced. The 14th key is not allowed to be entered and an error beep is produced. A dialogue box is displayed and the field is highlighted red. The key is not allowed to be entered and an error beep is produced. The key is not allowed to be entered and an error beep is produced. A dialogue box is displayed and the field is highlighted red.

The Book ID field is not listed above because the program will designate its value. A presence check will not be performed on the Publisher, Format and Comments fields because these fields are optional and less important than the other fields. In addition, the format field will not need to be validated because the input will be done through the use of a drop down list. The Room and Category type checks were later removed because the method of input changed from an edit box to a combo box.

Dharmesh Tailor

46

F454 Computing Project

Nature of the Solution

Data Inputs Field Title Author Category ISBN Publisher Format Room Comments

Data Processes • • • • • • • • • • • • • •

Table Book Table Book Table Book Table Book Table Book Table Book Table Book Table Book Table

Open forms Close forms Open user documentation New record Save record Delete record Next record Previous record Save file Validate fields Load records into table Sort records according to user defined parameters (the field to be sorted and the type of sort) Search record in table Print report

Dharmesh Tailor

47

F454 Computing Project

Nature of the Solution

Interface Designs – Hand Drawn frm_MainMenu

Dharmesh Tailor

48

F454 Computing Project

Nature of the Solution

frm_DesignView

Dharmesh Tailor

49

F454 Computing Project

Nature of the Solution

frm_ReportView

Dharmesh Tailor

50

F454 Computing Project

Nature of the Solution

On Screen Designs Form design prototypes created using the Lazarus Integrated Development Environment (IDE).

Dharmesh Tailor

51

F454 Computing Project

Nature of the Solution

frm_DesignView

Dharmesh Tailor

52

F454 Computing Project

Nature of the Solution

frm_ReportView

Dharmesh Tailor

53

F454 Computing Project

Nature of the Solution

Output Design Below is a preliminary design of the output that will be generated by the book database system. The design is based upon the samples I acquired during my observation of the current system.

Book Database System October 2011

Book ID: 1 Title: Oxford Handbook of General Practice Author: Chantal Simon ISBN: 0199236100

I have decided to keep the design as generic as possible without any information relating to Hillcrest Surgery. My reason for this is that there is a possibility that the information could change in the future and my end user would not be able to remove the information, as it would be hardcoded into the system. I wanted to make sure that the output design was as faithful as possible to the output design of the current system so that it would fulfil my end users’ needs successfully. The report will be generated and printed in the system rather than through an external application such as Microsoft Word. This is because applications installed on my end user’s computer may change in the future and this could lead to the inability to print reports which is essential for Hillcrest Surgery.

Dharmesh Tailor

54

F454 Computing Project

Nature of the Solution

Letter from End User – 11/10/11

Dharmesh Tailor

55

F454 Computing Project

Nature of the Solution

Meeting with end user I had a meeting with Dr Vijay Tailor at Hillcrest Surgery on Friday 14th October 2011. During the meeting, we looked through the interface designs and the output design and made a few changes to them. The following changes were agreed upon: •

Remove the ascending and descending options from the sort function in the Report View



form (only records shown in ascending order will ever be needed).



so that the input to these fields is controlled.



categories and rooms are not hard coded into the system.



room.



the new system.



forms.



mouse scroll feature to make the navigation between records more intuitive.

Replace the category and room edit boxes in the Design View form with drop down lists Read the categories and rooms from a text file so that if this changes in the future, the

Add the feature to customise the records table, showing the records in each category or Remove the user name field from the Main Menu because there will be only be 7 users of Add a help button to every form so that the user can view the help file from all of the Replace the next and previous record navigation feature in the Design View form with a

Add an edit button in the Design View form whereby the fields can only be edited if the



button is pressed.



needed.

Remove the next and previous record buttons in the Report View form, as they are not



Remove the search by book ID feature in the Design View form, as this is not needed.



record table can be printed after it has been customised.



particular book can be recorded.

Move the print report feature from the Design View to the Report View so that the Add a comments field in the Design View form so that any issues raised about a Change the design of the output so that the records are displayed in a table.

I have attached screenshots of the new interface designs taking into consideration the above changes.

Dharmesh Tailor

56

F454 Computing Project

Nature of the Solution

New Prototype Form Designs frm_MainMenu

Access to the help file will be included in every form.

frm_DesignView

This will enable all of the fields and set the read only property of the fields to false. The TUpDown object replaces the next and previous buttons and enables the ability to scroll using the mouse wheel. Input will be controlled using combo boxes which will be populated from a text file.

Dharmesh Tailor

57

F454 Computing Project

Nature of the Solution

frm_Report View

Records can be viewed by category or room.

This prints the table of records based on the design below.

Output Design

The records will be outputted in a table based on the string grid in the Report View form.

Dharmesh Tailor

58

F454 Computing Project

Nature of the Solution

Menu Design

Dharmesh Tailor

59

F454 Computing Project

Nature of the Solution

Storage Media and Format Security of data The library database system will be used to store the records of over 600 books therefore it is important that the database is password protected. There will be no need for user names because the number of users of the database will be limited. In addition, the users will all share the same security level therefore there will be no need to cater for different user access levels and all users will be given the same password to access the database. My end user and I have decided that there will be no need to maintain security due to the nature of the system; the surgery’s actual details are not stored except the name of the rooms in the surgery. When testing the database, I will be entering the records of real books taken from Hillcrest Surgery’s library. This complies with the Data Protection Act of 1998 because the surgery’s details are not stored in the system.

Backup Strategy

A backup strategy will be implemented as, in the new system, the data will be stored on the computer’s hard drive and corruption of either the disk or the data could result in loss of the data. An automatic backup feature integrated within the program will not be included firstly due to the time scope of the project and secondly if data corruption does occur on the computer’s hard drive, data automatically backed up on the drive would be ineffective in preventing the loss of data as all data on the drive would be corrupted.

The data will be backed up on a weekly basis by my end user, Dr Tailor. It will be done every Friday after working hours have finished and the backups will be stored on a Kingston Data Traveller 4GB Memory USB Stick. The files that will be backed up from the library database system will be the Library records File, stored as a ‘.DAT’ file, the Category File, stored as a ‘.TXT’ file and the Room File, also stored as a ‘.TXT’ file. The files are extremely small in size and the 4GB Memory stick will be large enough to back up the database files for a long time. As already mentioned, the files will be stored on the Memory stick under a folder named ‘Library Database Backups’. Within that folder, the files backed up weekly will be stored in a separate folder named according to the respective date of the backup. There will be no need to keep files dating back to more than 6 months therefore archiving of the backups will not be needed. Once the files have been backed up, the memory stick will be stored in a secure location in Hillcrest Surgery.

Kingston Data Traveller 4GB USB Flash Drive This will be used by Hillcrest Surgery to back up the library records.

Dharmesh Tailor

60

F454 Computing Project

Nature of the Solution

Data Size Calculations File

Total Size of 1 Record (bytes) LibraryDatabase.dat 416 Category.txt 10 Room.txt 12

Approx. maximum number of records 600 50 5 Total

Maximum Size (bytes) 249600 500 60 250160

The maximum size of the backup is: 250160 + 10% overheads = 275176 bytes = 269 kB

Dharmesh Tailor

61

F454 Computing Project

Algorithms

Algorithms An algorithm is a set of logical instructions written to solve a problem. They will be used in designing the computerised system because they will provide me with a description of the various processes that the system will perform. The algorithms will be written in pseudo code because this will allow me to focus on the logic behind each of the processes rather than writing them in a specific programming language. The advantage of writing the algorithms initially in pseudo code is that there is no need to follow the restrictions and syntax rules of a programming language. Furthermore, the algorithms are not language-specific therefore someone else could take the algorithms and write the code for them in some other programming language other than Delphi which is what I will be using.

The algorithms are as follows:

1. Verify the password entered and count the number of attempts

2. Read the Library File into the system

3. Read the Room File into the system (and Category File)

4. Display the records

5. Populate the Room combo box (and Category combo box) 6. Populate the Book ID Search combo box 7. Delete a record

8. Create a new record 9. Save a record 10. Save the file

11. Record navigation

12. Perform alphanumeric validation

13. Perform a length check validation

14. Search through the Book IDs

15. Fill the string grid

16. Auto size string grid

17. Perform a bubble sort

18. Perform search on string grid

Dharmesh Tailor

62

F454 Computing Project

Algorithms

1. Password Verification BEGIN Declare integer variable Maximum Attempts Declare integer variable Attempts Declare string variable Password Maximum Attempts = 3 INCREMENT Attempts IF Password entered by user = Password THEN Show the Design View Form Make the Main Menu Form invisible ELSE IF Attempts < Maximum Attempts THEN DISPLAY Error Message (‘You have entered the wrong password.’) Password Text Box = ‘’ ELSE DISPLAY Error Message (‘You have entered the wrong password 3 times. Please contact the administrator’) TERMINATE Application END 2. Read the Library File into the system

BEGIN Total Number of Records = 0 ASSIGN Library File as LibraryDatabase.DAT File RESET Library File WHILE not at the end of the Library File INCREMENT Total Number of Records READ the currently selected field in the Library File into the currently selected Library Record ENDWHILE CLOSE Library File Current Record Number = 1 Display records of the Current Record Number END 3. Read the Room File into the system (and Category File)

This is the same algorithm for reading the Category File into the system. BEGIN Declare text file Room File Declare string variable Room Declare string list Room List ASSIGN Room File as room.TXT File RESET Room File

Dharmesh Tailor

63

F454 Computing Project

Algorithms

WHILE not at the end of the Room File READ into Room the currently selected field in the Room File ADD Room to the Room List ENDWHILE CLOSE Room File END 4. Display the records

BEGIN Book ID Textbox = Book ID of the Current Record in the Library Records Room Combo box = Room of the Current Record in the Library Records Title Textbox = Title of the Current Record in the Library Records Author Textbox = Author of the Current Record in the Library Records Category Combo box = Category of the Current Record in the Library Records ISBN Textbox = ISBN of the Current Record in the Library Records Publisher Textbox = Publisher of the Current Record in the Library Records Format Combo box = Format of the Current Record in the Library Records Comments Textbox = Comments of the Current Record in the Library Records Current Record Number Label = Current Record Number Total Number of Records Label = Total Number of Records END 5. Populate the Room combo box

This is the same algorithm for populating the Category combo box. BEGIN Declare string list Room List Declare integer variable Count FOR Count = 0 to Room List Count – 1 ADD ITEM Room List (Count) to Room Combo box ENDFOR END 6. Populate the Book ID Search combo box

This feature was later removed after end user feedback but I have included it as a reference. BEGIN Declare integer variable Count REPEAT ADD ITEM Library Records Book ID (Count) to Book ID Search Combo box INCREMENT Count UNTIL Count = Total Number of Records ENDREPEAT END

Dharmesh Tailor

64

F454 Computing Project

Algorithms

7. Delete a record BEGIN Declare integer variable Count DISPLAY Warning Message (‘Are you sure you want to delete this record?’) IF No EXIT ENDIF ELSE IF Current Record Number = 1 AND Total Number of Records > 1 FOR Count = Current Record Number to Total Number of Records – 1 Library Records (Count) = Library Records (Count + 1) ENDFOR DECREMENT Total Number of Records DISPLAY Record of the Current Record Number DISPLAY Information Message (‘Record deleted’) EXIT ENDIF IF Current Record Number = 1 and Total Number of Records = 1 DECREMENT Total Number of Records DECREMENT Current Record Number DISPLAY Record of the Current Record Number DISPLAY Information Message (‘File is now empty’) EXIT ENDIF FOR Count = Current Record Number to Total Number of Records – 1 Library Records (Count) = Library Records (Count + 1) ENDFOR DECREMENT Total Number of Records DECREMENT Current Record Number DISPLAY Record of the Current Record Number DISPLAY Information Message (‘Record deleted’) END 8. Create a new record

BEGIN Current Record Number = Total Number of Records + 1 Current Record Number Label = Current Record Number IF Total Number of Records = 0 Book ID Textbox = 1 ELSE Book ID Textbox = Total Number of Records + 1 ENDIF Room Combo box Item Index = -1 Title Textbox = ‘’ Author Textbox = ‘’

Dharmesh Tailor

65

F454 Computing Project

Algorithms

Category Combo box Item Index = -1 ISBN Textbox = ‘’ Publisher Textbox = ‘’ Format Combo box Item Index = -1 Comments Text box = ‘’ END 9. Save a record

BEGIN Declare boolean variable Don’t Save Don’t Save = False IF Room Combo box Item Index = -1 Don’t Save = True DISPLAY Information Message (‘Room is missing’) Room Combo box Colour = Red ELSE Room Combo Box Colour = Default ENDIF IF Title Textbox = ‘’ Don’t Save = True DISPLAY Information Message (‘Title is missing’) Title Textbox Colour = Red ELSE Title Textbox Colour = Default ENDIF IF Author Textbox = ‘’ Don’t Save = True DISPLAY Information Message (‘Author is missing’) Author Textbox Colour = Red ELSE Author Textbox Colour = Default ENDIF IF Category Combo box Item Index = -1 Don’t Save = True DISPLAY Information Message (‘Category is missing’) Category Combo box Colour = Red ELSE Category Combo Box Colour = Default ENDIF IF ISBN Textbox = ‘’ Don’t Save = True DISPLAY Information Message (‘ISBN is missing’) ISBN Textbox Colour = Red ELSE ISBN Textbox Colour = Default

Dharmesh Tailor

66

F454 Computing Project

Algorithms

ENDIF IF Don’t Save = False Save Record of Current Record Number IF Current Record Number > Total Number of Records INCREMENT Total Number of Records ENDIF DISPLAY Information Message (‘Record Saved’) DISPLAY Record of Current Record Number ENDIF END 10. Save the file

BEGIN Declare integer variable Count ASSIGN Library File as LibraryDatabase.DAT File REWRITE Library File FOR Count = 1 to Total Number of Records WRITE the Library Records (Count) into the Library File ENDFOR CLOSE Library File DISPLAY Information Message (‘File Saved.’) END 11. Record navigation

This is the algorithm for navigating to the next record. BEGIN IF Current Record Number < Total Number of Records INCREMENT Current Record Number DISPLAY Record of the Current Record Number ENDIF END

This is the algorithm for navigating to the previous record. BEGIN IF Current Record Number > 1 DECREMENT Current Record Number DISPLAY Record of the Current Record Number ENDIF END

Dharmesh Tailor

67

F454 Computing Project

Algorithms

12. Perform alphanumeric validation This algorithm will be used to validate the Title textbox, Author textbox, ISBN textbox, Publisher textbox and Comments memo. BEGIN IF Key pressed is NOT Shift, Backspace, Letters (‘A’ to ‘Z’ and ‘a’ to ‘z’), Numbers (‘0’ to ‘9’) Produce error BEEP Key is not allowed to be entered ENDIF END 13. Perform a length check validation

This algorithm will be used to validate the Title textbox, Author textbox, ISBN textbox, Publisher textbox and Comments memo. BEGIN IF Length of Publisher Textbox > 19 Produce error BEEP Key is not allowed to be entered ENDIF END 14. Search through the Book IDs

This feature was later removed after end user feedback but I have included it as a reference. BEGIN Declare integer variable Count Declare boolean variable Found Found = False FOR Count = 1 to Total Number of Records IF Search Book ID Textbox = Book ID in Library Records (Count) Found = True Current Record Number = Count DISPLAY the record of the Current Record Number ENDIF ENDFOR IF Found = False DISPLAY Error Message (‘No Book ID selected’) ENDIF END

Dharmesh Tailor

68

F454 Computing Project

Algorithms

15. Fill the string grid BEGIN Declare integer variable Count String Grid Row Count = Total Number of Records + 1 FOR Count = 1 to Total Number of Records String Grid Cells (0, Count) = Library Records (Count) Book ID String Grid Cells (1, Count) = Library Records (Count) Title String Grid Cells (2, Count) = Library Records (Count) Author String Grid Cells (3, Count) = Library Records (Count) ISBN ENDFOR END 16. Auto size string grid

BEGIN Declare integer variable Column Width Minimum Declare integer variable Column Width Maximum Declare integer variable C Declare integer variable R Declare integer variable W FOR C = 0 to String Grid Column Count – 1 Column Width Maximum = Column Width Minimum FOR R = 0 to String Grid Row Count – 1 W = String Grid Text Width Cells (C, R) IF W > Column Width Maximum Column Width Maximum = W ENDIF ENDFOR String Grid Column Width (C) = Column Width Maximum + 10 ENDFOR END

Dharmesh Tailor

69

F454 Computing Project

Algorithms

17. Perform a bubble sort This algorithm will be used to sort the String Grid. The String Grid will be sorted by Book ID, Title, Author and ISBN. BEGIN Declare boolean variable Swap Performed Declare integer variable Count Count = Total Number of Records REPEAT Swap Performed = False FOR Record Number = 1 to Count – 1 IF Book ID in Library Records (Record Number) > Book ID in Library Records (Record Number + I) Temporary Record = Library Records (Record Number) Library Records (Record Number) = Library Records (Record Number + 1) Library Records (Record Number + 1) = Temporary Record Swap Performed = True ENDIF ENDFOR DECREMENT Count UNTIL Swap Performed = False OR Count = 1 END 18. Perform search on string grid

BEGIN Declare integer variable nRow String Grid Column = Search Combo box Item Index FOR nRow = 1 to String Grid Row Count – 1 IF Search Textbox = String Grid Cells (Search Combo box Item Index, nRow) String Grid Row = nRow ENDIF ENDFOR END

Dharmesh Tailor

70

F454 Computing Project

Algorithms

Testing Algorithms I have tested each algorithm by stepping through them, line by line, with test data to ensure that they work as expected and to ensure that the desired result is obtained. In addition, I have produced trace tables which show the results for each algorithm tested.

Below, I have included an example of one such test that I performed on my bubble sort algorithm. 17. Perform a bubble sort algorithm

1 BEGIN 2 Declare boolean variable Swap Performed 3 Declare integer variable Count 4 Count = Total Number of Records 5 REPEAT 6 Swap Performed = False 7 FOR Record Number = 1 to Count – 1 8 IF Book ID in Library Records (Record Number) > Book ID in Library Records (Record Number + I) 9 Temporary Record = Library Records (Record Number) 10 Library Records (Record Number) = Library Records (Record Number + 1) 11 Library Records (Record Number + 1) = Temporary Record 12 Swap Performed = True 13 ENDIF 14 ENDFOR 15 DECREMENT Count 16 UNTIL Swap Performed = False OR Count = 1 17 END Test Data

Library Records Array: Record Number Book ID 1 23 2 6 3 108 4 56 5 12

Dharmesh Tailor

71

F454 Computing Project

Algorithms

Trace Table Pass One Line of Code

Count

4 6 7 9 10 11 12 7 7 9 10 11 12 7 9 10 11 12 15

5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 4

Record Record Number Number +1

Book ID in Library Records (Record Number)

Book ID in Library Records (Record Number + 1)

1 1 1 1 1 2 3 3 3 3 3 4 4 4 4 4

23 23 6 6 6 23 108 108 56 56 56 108 108 12 12 12

6 6 6 23 23 108 56 56 56 108 108 12 12 12 108 108

2 2 2 2 2 3 4 4 4 4 4 5 5 5 5 5

Temporary Swap Record Performed

23 23 23 23 23 23 108 108 108 108 108 108 108 108 108

False False False False False True True True True True True True True True True True True

The data now looks like this: Record Number 1 2 3 4 5

Dharmesh Tailor

Book ID 6 23 56 12 108

72

F454 Computing Project

Algorithms

Pass Two Line Count of Code

6 7 7 7 9 10 11 12 15

4 4 4 4 4 4 4 4 3

Record Number

1 2 3 3 3 3 3

Record Book ID Number in Library +1 Records (Record Number)

2 3 4 4 4 4 4

6 23 56 56 12 12 12

Book ID in Temporary Library Record Records (Record Number + 1) 23 56 12 12 12 56 56

56 56 56 56

Swap Performed

False False False False False False False True

The data now looks like this: Record Number 1 2 3 4 5

Pass Three Line of Code

Count

6 7 7 9 10 11 12 15

3 3 3 3 3 3 3 2

Book ID 6 23 12 56 108

Record Number

1 2 2 2 2 2

Dharmesh Tailor

Record Number +1

2 3 3 3 3 3

Book ID in Library Records (Record Number)

6 23 23 12 12 12

Book ID in Library Records (Record Number + 1) 23 12 12 12 23 23

Temporary Record

Swap Performed

23 23 23 23

False False False False False False True

73

F454 Computing Project

Algorithms

The data now looks like this: Record Number 1 2 3 4 5

Pass Four

Book ID 6 12 23 56 108

The records have already been sorted correctly as shown above, however as a swap was made between the 2nd and 3rd record in Pass Three, a comparison still needs to be made between the 1st and 2nd record in Pass Four even though the records are now in the correct order. Line of Code

Count

6 7 15

2 2 1

Record Number

1

Record Number +1

2

Book ID in Library Records (Record Number)

6

Book ID in Library Records (Record Number + 1) 12

Temporary Swap Record Performed

False False

The records have been sorted by Book ID in ascending order which is what I expected. The algorithm should now sort successfully when implemented in the program.

Dharmesh Tailor

74

F454 Computing Project

Test Strategy

Test Strategy I have devised a test plan for my library database system. The test plan will be followed during testing and this will ensure that the database can handle all types of data and that the correct output is produced. I have decided to divide the test plan into three sections, one for each form. I will be using a variety of different testing methods to ensure that the system works as expected and to remove any bugs that may arise. The different testing methods I will be using are: 











Black Box Testing – This is where inputs are tested against the expected output without considering how the program works. When using this method of testing, the common case will be entering a certain value into a textbox or clicking on a particular button. The test will only fail if the output onscreen is different to the expected output. Black box testing will be used to test the general functions of the program rather than testing the logic of the code. White Box Testing – This is where the algorithm in a particular piece of code is run through step-by-step where each line of code is checked to ensure that it makes sense logically and the correct output is produced. The test will only fail if a flaw in the logic of the code is detected which results in the incorrect output being produced. White box testing will be used to test the more complicated procedures such as the sorting of records or saving of the database file where the code is more difficult to follow. Validation Testing – This involves testing the validation algorithms within the code to ensure that the program accepts acceptable inputs and the program rejects unacceptable inputs. As mentioned previously, I intend to use three types of validation checks in my program (type, length and presence checks) and these will need to be tested.

Integration Testing – This involves testing the program in its entirety by ensuring that the individual modules link together successfully. The majority of the integration tests will be testing to see whether the buttons open their respective forms. Other tests will involve checking if the necessary variables are being passed through the program. Integration testing will be included as a separate section in testing. Acceptance Testing – This involves the end user taking the completed program and testing it extensively to ensure that the requirements agreed have been met. Acceptance testing is a test of the overall system and therefore it is not used to test the individual procedures. This test will be addressed in the Evaluation section of the project.

Alpha Testing – This is testing carried out internally within the developer’s organisation, usually performed by a dedicated testing team. The testing team would act as the end user and test the functionality of everyday tasks that would be expected

Dharmesh Tailor

75

F454 Computing Project



Test Strategy

of the program. Alpha testing is useful as any bugs found can be reported and fixed quickly. As I am the only one developing this application, all tests carried out, except acceptance testing, are examples of alpha testing.

Beta Testing – This is testing usually carried out by potential users of the program. The program is tested under normal operating conditions and any bugs found can be reported back to the development team. In my case, the end users of the library database system will be given a beta version of the program. I will be given direct feedback from the end users and this will help to steer the direction of development.

Test Plan

Main Menu Test Number 1

What to Test Enter correct password

Type of Test Black Box

2

Enter incorrect password once

Black Box

3

Incorrect password entered three times

Black Box

4

Load help file

Black Box

5

Close application

Dharmesh Tailor

Black Box

Test Data Used While the password is set to ‘orange’ enter ‘orange’. While the password is set to ‘orange’ enter ‘pear’. While the password is set to ‘orange’ enter ‘pear’. The incorrect password is entered three times.

The Help button is pressed. The Close button is pressed.

Expected Result The Design View form is displayed. An error message is displayed informing the user that the password is incorrect. An error message is displayed informing the user that the password is incorrect. The number of attempts remaining decrements by 1 every time an incorrect password is entered. The program will terminate after the 3rd unsuccessful attempt. The Help.PDF file is displayed. The application is closed.

76

F454 Computing Project

Test Strategy

Design View Test Number 6

What to Test

7

Populate Room Combo Box with data from Room.TXT file.

8

9

10

Populate fields with records from LibraryDatabase.DAT file.

Populate Category Combo Box with data from Category.TXT file.

Type of Test Black Box

Black Box Black Box

Validate the characters Validation entered into the Title - Type field. Check

Validate the characters Validation entered into the - Type Author field. Check

Dharmesh Tailor

Test Data Used

Expected Result

The fields will be initially filled with data and saved to file. The program will be restarted to test whether the records will be read back into the system. Room.TXT will be filled with the list of rooms in Hillcrest Surgery. Category.TXT will be filled with the list of categories obtained during Investigation. Normal: All letters in the alphabet (both uppercase and lowercase), numbers and a space are entered. Erroneous: All other characters are tested following this. (E.g. ], [, /, `) Normal: All letters in the alphabet (both uppercase and lowercase) and a space are entered. Erroneous: All other characters including digits are tested following this. (E.g. 6, 1, 7, 9)

The fields are populated with data from the LibraryDatabase.DAT file.

The combo box is populated with data from the Room.TXT file. The combo box is populated with data from the Category.TXT file.

Letters, numbers and spaces should be allowed. All other characters should not be accepted and an error beep should be produced.

Letters and spaces should be allowed. All other characters should not be accepted and an error beep should be produced.

77

F454 Computing Project

Test Strategy

11

Validate the characters Validation entered into the ISBN - Type field. Check

12

Validate the characters Validation entered into the - Type Publisher field. Check

13

Populate the Format Combo Box. Validate the length of the IBSN field.

Black Box

15

Presence Check

Validation

16

Save Record

Black Box and White Box

14

Dharmesh Tailor

Validation - Length Check

Normal: Numbers are entered. Erroneous: All other characters including letters are tested following this. (E.g. A, H, q, t) Normal: All letters in the alphabet (both uppercase and lowercase) and a space are entered. Erroneous: All other characters including digits are tested following this. (E.g. 4, 1, 9, 7) Click the Format Combo Box. Normal: 12 digits are entered. Borderline: The 13th digit is entered. Erroneous: More digits are entered. The Title, Author, Category, Room and ISBN fields are empty and the Save Record button is pressed. All fields are entered with valid data and the Save Record button is pressed.

Numbers should be allowed. All other characters should not be accepted and an error beep should be produced. Letters and spaces should be allowed. All other characters should not be accepted and an error beep should be produced.

The combo box is populated. 13 digits should be accepted and the 14th digit should not be accepted and an error beep should be produced.

Information messages should be displayed for each field and the fields should be highlighted red. The record is saved and an information message is displayed confirming this. The fields are all disabled and their read-only property is set to true.

78

F454 Computing Project

17

Save File

18

New Record

19

Test Strategy

Black Box and White Box

Four valid records are saved and the Save File button is pressed. The New Record button is pressed.

Edit Record

Black Box

20

Next Record

Black Box

The second record is displayed and the Edit Record button is pressed. The mouse scroll wheel is scrolled downwards.

21

Previous Record

Black Box

The mouse scroll wheel is scrolled upwards.

22

Delete Record

Black Box

The second record is displayed and the Delete Record Button is pressed.

23

Open the Report View form

Black Box

The Report View button is pressed.

Dharmesh Tailor

Black Box

The file is saved and an information message is displayed confirming this. All fields are blanked. The Current Record Number is incremented. The fields are all enabled and their read-only property is set to false. The fields are all enabled and their read-only property is set to false. The next record is displayed and the Current Record Number is incremented. The previous record is displayed and the Current Record Number is decremented. The user is asked whether they are sure they want to delete the currently selected record. If ‘Yes’ is selected, then the record is deleted and the Current Record Number and Total Number of Records are decremented. An information message is displayed after the record has been successfully deleted. The Report View form is displayed.

79

F454 Computing Project

Test Strategy

24

Close Application with Open Records

Black Box

25

Close Application

Black Box

The first record is displayed and the Edit Record button is pressed. The Close button is pressed. The Close Button is pressed.

Report View Form

An information message will appear telling the user to close any unsaved records.

A confirmation dialog box will appear asking the user if they are sure they want to close the application. If ‘Yes’ is selected then the application is closed.

Test What to Test Number 26 Fill String Grid Column Headers

Type of Test

Test Data Used

Expected Result

Black Box

The Report View form is loaded.

27

Populate Search Combo Box

Black Box

Click the Search Combo Box

The String Grid is filled with column headers on form create. The combo box is populated on form create. The combo box is populated on form create. The String Grid is filled with the records saved in the LibraryDatabase.DAT file. The List Box is filled with the list of rooms saved in the room.TXT file. The List Box is filled with the list of categories saved in the category.TXT file.

28

Populate Sort Combo Box

Black Box

Load Records into String Grid

Black Box

30

Fill List Box with Rooms

Black Box

31

Fill List Box with Categories

Black Box

29

Dharmesh Tailor

Click the Sort Combo Box

The ‘All’ option is selected in the Radio Group. The ‘Rooms’ option is selected in the Radio Group. The ‘Categories’ option is selected in the Radio Group.

80

F454 Computing Project

Test Strategy

32

Load Records of particular Room into String Grid

Black Box

33

Load Records of the Corresponding Category into String Grid

Black Box

34

Load record into Design View Form

Black Box

35

Search Record

Black Box

36

Sort Records Alphabetically

Black Box

37

Sort Records Numerically

Black Box

Dharmesh Tailor

The ‘Rooms’ option is selected in the Radio Group. The room, ‘Dr Tailor’s Room’, is selected in the List Box. The ‘Categories’ option is selected in the Radio Group. The category, ‘Infectious Diseases’, is selected in the List Box. The ‘All’ option is selected in the Radio Group. The second record in the String Grid is selected. Select the Title field in the Search Combo Box. Enter ‘Ox’ in the Search Textbox. Select the Author field in the Sort Combo Box. Select the ISBN field in the Sort Combo Box.

The String Grid is filled with the records whose Room field is ‘Dr Tailor’s Room’. The String Grid is filled with the records whose Category field is ‘Infectious Diseases’.

The record selected is loaded into the Design View Form. The record titled ‘Oxford Handbook of Infectious Diseases’ should be highlighted. The records should be sorted alphabetically ascending according to the Author field. The records should be sorted numerically ascending according to the ISBN field.

81

F454 Computing Project

Test Strategy

38

Print Report

Black Box

Print Button is pressed.

39

Close Form

Black Box

Close Button is pressed.

Dharmesh Tailor

A report of the records loaded into the String Grid is generated and this is printed. An information message is displayed confirming this. A confirmation dialog box will appear asking the user if they are sure they want to close the form. If ‘Yes’ is selected then the form is closed.

82

F454 Computing Project

Software Development & Testing

Software Development & Testing As the only one developing this system, all early testing was done by me as alpha testing. The only exception to this is the testing carried out by the end user, beta testing, which was conducted in stages at specific points during the development of the system. The majority of tests were conducted during the development of the system with a small minority done after development. Integration testing, a test to ensure the modules all link together successfully, was conducted after all the other tests. During software testing, a variety of tests were conducted including: black box testing, white box testing and validation testing. The tests follow the test strategy in the Design section. I have provided evidence for the tests in the form of annotated screenshots. The code for each test has also been attached, with comments to explain the purpose of the various parts.

Before any coding could commence, I had to ensure that the forms for the modules were final and complete. The forms have been included on the next page, taken from the Design section. They were designed in the Lazarus Integrated Development Environment (IDE) by drawing labels, buttons, text boxes and combo boxes (objects) as planned in the Design section. The objects were customised and laid out as agreed during the last meeting I had with my end user. The objects provide a medium by which the user can input data but also where the data inputted can be displayed back to the user.

Many important decisions were made when developing the system. Many of the decisions greatly affected the outcome of the system and how it was coded. The decisions were successfully made due to the regular communication I had with my end user. These will be discussed in greater detail later on.

I came across some problems during software development and testing. These problems have been highlighted in this section and I have shown how I overcame the problems by a combination of further code development and testing. Examples of this include the code for the Delete Button procedure and the Presence Check procedure.

Once the system is complete and all testing has been conducted, the final program will be sent to be end user for acceptance testing. In acceptance testing, my end user will check the system against the agreed requirements.

Dharmesh Tailor

83

F454 Computing Project

Software Development & Testing

Interface Designs frm_MainMenu

frm_DesignView

frm_ReportView

Dharmesh Tailor

84

F454 Computing Project

Software Development & Testing

Library Database System I have divided the software development and testing into three sections. This corresponds to the order in which I developed the modules. The sections are: •

• •

Section One: Manipulation of records in Library Database Design View

Section Two: Loading, sorting, searching and printing of records in Library Database Report View Section Three: Main Menu System

Section One: Library Database Design View This unit deals with the manipulation of records – adding, saving and deleting records. It also allows navigation between records. The following table has been taken from the test strategy in the Design section, however with each test’s outcome. Each test will be documented in more detail further in the report.

Test No. 6

What to Test

Type of Test

Test Data Used

Populate fields with records from LibraryDatabase. DAT file.

Black Box

7

Populate Room Combo Box with data from Room.TXT file.

Black Box

The fields will be initially filled with data and saved to file. The program will be restarted to test whether the records will be read back into the system. Room.TXT will be filled with the list of rooms in Hillcrest Surgery.

8

Populate Category Combo Box with data from Category.TXT file.

Black Box

Dharmesh Tailor

Expected Result The fields are populated with data from the LibraryDatab ase.DAT file.

Actual Result

The combo box is populated with data from the Room.TXT file. Category.TXT will The combo be filled with the box is list of categories populated obtained during with data Investigation. from the Category.TXT file.

The combo box is populated with data from the Room.TXT file. The combo box is populated with data from the Category.TXT file.

The fields are populated with data from the LibraryDatab ase.DAT file.

Test Passed? Yes

Yes

Yes

85

F454 Computing Project

9

Validate the characters entered into the Title field.

Validation Type Check

10

Validate the characters entered into the Author field.

Validation Type Check

11

Validate the characters entered into the ISBN field.

Validation Type Check

Dharmesh Tailor

Software Development & Testing

Normal: All letters in the alphabet (both uppercase and lowercase), numbers and a space are entered. Erroneous: All other characters are tested following this. (E.g. ], [, /, `) Normal: All letters in the alphabet (both uppercase and lowercase) and a space are entered. Erroneous: All other characters including digits are tested following this. (E.g. 6, 1, 7, 9) Normal: Numbers are entered. Erroneous: All other characters including letters are tested following this. (E.g. A, H, q, t)

Letters, numbers and spaces should be allowed. All other characters should not be accepted and an error beep should be produced.

Letters, Yes numbers and spaces are allowed. All other characters are not accepted and an error beep is produced.

Letters and spaces should be allowed. All other characters should not be accepted and an error beep should be produced.

Letters and Yes spaces are allowed. All other characters are not accepted and an error beep is produced.

Numbers should be allowed. All other characters should not be accepted and an error beep should be produced.

Numbers are Yes allowed. All other characters are not accepted and an error beep is produced.

86

F454 Computing Project

12

Validate the characters entered into the Publisher field.

Validation Type Check

13

Populate the Format Combo Box. Validate the length of the IBSN field.

Black Box

15

Presence Check

Validation

16

Save Record

Black Box and White Box

14

Dharmesh Tailor

Validation Length Check

Software Development & Testing

Normal: All letters in the alphabet (both uppercase and lowercase) and a space are entered. Erroneous: All other characters including digits are tested following this. (E.g. 4, 1, 9, 7) Click the Format Combo Box.

Letters and spaces should be allowed. All other characters should not be accepted and an error beep should be produced.

The combo box is populated. Normal: 12 digits 13 digits are entered. should be Borderline: The accepted and th 13 digit is the 14th digit entered. should not be Erroneous: More accepted and digits are an error beep entered. should be produced. The Title, Author, Information Category, Room messages and ISBN fields should be are empty and displayed for the Save Record each field and button is pressed. the fields should be highlighted red. All fields are The record is entered with saved and an valid data and the information Save Record message is button is pressed. displayed confirming this. The fields are all disabled and their readonly property is set to true.

Letters and Yes spaces are allowed. All other characters are not accepted and an error beep is produced.

The combo box is populated. 13 digits are accepted and the 14th digit is not accepted and an error beep is produced.

Yes

Information messages are displayed for each field and the fields are highlighted red.

Yes

The record is saved and an information message is displayed confirming this. The fields are all disabled and their readonly property is set to true.

Yes

Yes

87

F454 Computing Project

Software Development & Testing

17

Save File

Black Box and White Box

Four valid records are saved and the Save File button is pressed.

18

New Record

Black Box

The New Record button is pressed.

19

Edit Record

Black Box

20

Next Record

Black Box

The second record is displayed and the Edit Record button is pressed.

21

Previous Record

Black Box

Dharmesh Tailor

The mouse scroll wheel is scrolled downwards.

The mouse scroll wheel is scrolled upwards.

The file is saved and an information message is displayed confirming this. All fields are blanked. The Current Record Number is incremented. The fields are all enabled and their read-only property is set to false. The fields are all enabled and their read-only property is set to false. The next record is displayed and the Current Record Number is incremented. The previous record is displayed and the Current Record Number is decremented.

The file is saved and an information message is displayed confirming this. All fields are blanked. The Current Record Number is incremented. The fields are all enabled and their read-only property is set to false. The fields are all enabled and their read-only property is set to false. The next record is displayed and the Current Record Number is incremented. The previous record is displayed and the Current Record Number is decremented.

Yes

Yes

Yes

Yes

Yes

88

F454 Computing Project

22

Delete Record

Black Box

23

Open the Report View form

Black Box

24

Close Application with Open Records

Dharmesh Tailor

Black Box

Software Development & Testing

The second record is displayed and the Delete Record Button is pressed.

The user is asked whether they are sure they want to delete the currently selected record. If ‘Yes’ is selected, then the record is deleted and the Current Record Number and Total Number of Records are decremented. An information message is displayed after the record has been successfully deleted. The Report View The Report button is pressed. View form is displayed. The first record is An displayed and the information Edit Record message will button is pressed. appear telling The Close button the user to is pressed. close any unsaved records.

The user is Yes asked whether they are sure they want to delete the currently selected record. If ‘Yes’ is selected, then the record is deleted and the Current Record Number and Total Number of Records are decremented. An information message is displayed after the record has been successfully deleted. The Report View form is displayed. An information message will appear telling the user to close any unsaved records.

Yes Yes

89

F454 Computing Project

25

Close Application

Dharmesh Tailor

Black Box

Software Development & Testing

The Close Button is pressed.

A confirmation dialog box will appear asking the user if they are sure they want to close the application. If ‘Yes’ is selected then the application is closed.

A confirmation dialog box will appear asking the user if they are sure they want to close the application. If ‘Yes’ is selected then the application is closed.

Yes

90

F454 Computing Project

Software Development & Testing

Unit Declaration of Variables and Procedures unit Unit1; interface uses Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls, DbCtrls, ComCtrls, EditBtn, Buttons, ExtCtrls, Menus, LCLType, ShellAPI; type Tfrm_DesignView = class(TForm) btn_newrecord: TBitBtn; btn_deleterecord: TBitBtn; btn_editrecord: TButton; btn_savefile: TButton; btn_saverecord: TButton; btn_cancel: TButton; btn_close: TButton; btn_reportview: TButton; btn_help: TButton; cmb_category: TComboBox; cmb_format: TComboBox; cmb_room: TComboBox; edt_currentrecordno: TEdit; edt_author: TEdit; edt_publisher: TEdit; edt_bookid: TEdit; edt_isbn: TEdit; edt_title: TEdit; Label1: TLabel; Label2: TLabel; lbl_format: TLabel; lbl_totalnoofrecords: TLabel; lbl_room: TLabel; lbl_bookid: TLabel; lbl_comments: TLabel; lbl_isbn: TLabel; lbl_category: TLabel; lbl_title: TLabel; lbl_author: TLabel; lbl_publisher: TLabel; memo_comments: TMemo; UpDown1: TUpDown; procedure btn_cancelClick(Sender: TObject); procedure btn_closeClick(Sender: TObject); procedure btn_deleterecordClick(Sender: TObject); procedure btn_editrecordClick(Sender: TObject); procedure btn_newrecordClick(Sender: TObject); procedure btn_reportviewClick(Sender: TObject); procedure btn_savefileClick(Sender: TObject); procedure btn_saverecordClick(Sender: TObject); procedure edt_authorKeyPress(Sender: TObject; var Key: char); procedure edt_currentrecordnoChange(Sender: TObject);

Dharmesh Tailor

91

F454 Computing Project

Software Development & Testing

procedure edt_isbnKeyPress(Sender: TObject; var Key: char); procedure edt_publisherKeyPress(Sender: TObject; var Key: char); procedure edt_titleKeyPress(Sender: TObject; var Key: char); procedure FormCloseQuery(Sender: TObject; var CanClose: boolean); procedure FormCreate(Sender: TObject); procedure FormMouseWheelDown(Sender: TObject); procedure FormMouseWheelUp(Sender: TObject); procedure memo_commentsKeyPress(Sender: TObject; var Key: char); procedure UpDown1Changing(Sender: TObject); private { private declarations } public { public declarations } end; var frm_DesignView: Tfrm_DesignView; type //This sets up the fields TLibrary = Record BookID : Integer; Room : String[20]; Title : String[40]; Author : String[20]; Category : String[20]; ISBN : String[13]; Publisher : String[20]; Format : String[15]; Comments : String[255]; end; const MaxRecords = 600; var LibraryRecords : Array[1..MaxRecords] of TLibrary; LibraryFile : File of TLibrary; TotalNoOfRecords, CurrentRecordNo, RestoreCurrentRecordNo : Integer; Scroll : Boolean; ProgramClose : Boolean; CategoryFile : TextFile; category : String; CategoryList : TStringList; RoomFile : TextFile; room : String; RoomList : TStringList;

Dharmesh Tailor

92

F454 Computing Project

Software Development & Testing

7. Populate Room Combo Box with data from Room.TXT file What to Test Populate Room Combo Box with data from Room.TXT file.

Type of Test Black Box

Test Data Used Click the Room Combo Box

Expected Result The combo box is populated with data from the Room.TXT file.

Actual Result The combo box is populated with data from the Room.TXT file.

Test Passed? Yes

Black Box Test:

The list of rooms has been entered into the Room.TXT file.

The Room Combo box is populated on form create with data from the Room.TXT file.

Code development: The code to populate the Room Combo Box was developed from the algorithm: 3. Read the Room File into the system (and Category File) The algorithm has been attached on the next page but can also be found on page 59 in the Algorithms section.

Dharmesh Tailor

93

F454 Computing Project

Software Development & Testing

3. Read the Room File into the system (and Category File) BEGIN Declare text file Room File Declare string variable Room Declare string list Room List ASSIGN Room File as room.TXT File RESET Room File WHILE not at the end of the Room File READ into Room the currently selected field in the Room File ADD Room to the Room List ENDWHILE CLOSE Room File END Code to populate Room Combo Box: The following procedure reads the rooms from the room.TXT file into a string list. procedure DisplayRoom; var RoomFile : TextFile; room : String; RoomList : TStringList; begin AssignFile(RoomFile, 'room.txt'); Reset(RoomFile); //This creates a String List, used to store the rooms temporarily RoomList := TStringList.Create; while NOT EOF(RoomFile) do begin //This reads each line from the Room.TXT file Readln(RoomFile, Room); //This adds each line to the Room String List RoomList.Add(Room); end; CloseFile(RoomFile); end;

The following code runs the DisplayRoom procedure on Form Create. The Room Combo Box is filled with the rooms from the Room String List. procedure Tfrm_DesignView.FormCreate(Sender: TObject); var i : integer; begin DisplayRoom; //This runs the DisplayRoom procedure for i := 0 to RoomList.Count - 1 do begin //This adds the rooms from the Room String List into the Room Combo Box cmb_room.Items.Add(RoomList[i]); end; end;

Dharmesh Tailor

94

F454 Computing Project

Software Development & Testing

8. Populate Category Combo Box with data from Category.TXT file What to Test Populate Category Combo Box with data from Category.TXT file.

Type of Test Black Box

Test Data Used Click the Category Combo Box

Expected Result The combo box is populated with data from the Category.TXT file.

Actual Result The combo box is populated with data from the Category.TXT file.

Test Passed? Yes

Black Box Test:

The list of categories has been entered into the Category.TXT file.

Dharmesh Tailor

95

F454 Computing Project

Software Development & Testing

The Category Combo box is populated on form create with data from the Category.TXT file.

Deciding upon the most suitable method of inputting the rooms and categories into their respective combo boxes was a key decision for me. Instead of the usual procedure of coding every line (see the procedure for populating the Format combo box), I decided to read the items from a text file. This means that in the future, if the categories or rooms change, then the data in the text files can be easily amended and they will not be hard-coded into the system.

Code development: The code to populate the Category Combo Box was developed from the algorithm: 3. Read the Room File into the system (and Category File) The algorithm has been attached on the next page but can also be found on page 59 in the Algorithms section.

Dharmesh Tailor

96

F454 Computing Project

Software Development & Testing

3. Read the Room File into the system (and Category File) BEGIN Declare text file Room File Declare string variable Room Declare string list Room List ASSIGN Room File as room.TXT File RESET Room File WHILE not at the end of the Room File READ into Room the currently selected field in the Room File ADD Room to the Room List ENDWHILE CLOSE Room File END Code to populate Category Combo Box: The following procedure reads the categories from the category.TXT file into a string list. procedure DisplayCategory; var CategoryFile : TextFile; category : String; CategoryList : TStringList; begin AssignFile(CategoryFile, 'category.txt'); Reset(CategoryFile); //This creates a String List, used to store the categories temporarily CategoryList := TStringList.Create; while NOT EOF(CategoryFile) do begin //This reads each line from the Categories.TXT file Readln(CategoryFile, Category); //This adds each line to the Category String List CategoryList.Add(Category); end; CloseFile(CategoryFile); end;

This runs the DisplayCategory procedure on Form Create and the Category Combo Box is filled with the categories from the Category String List. procedure Tfrm_DesignView.FormCreate(Sender: TObject); var i : integer; begin DisplayCategory; //This runs the DisplayCategory procedure for i := 0 to CategoryList.Count - 1 do begin //This adds the categories from the Category String List into the Room Combo Box cmb_category.Items.Add(CategoryList[i]); end; end;

Dharmesh Tailor

97

F454 Computing Project

Software Development & Testing

9. Validate Characters entered into Title Field What to Test Validate the characters entered into the Title field.

Type of Test Validation - Type Check

Test Data Used

Expected Result Normal: Letters, All letters in the numbers and alphabet (both spaces should uppercase and be allowed. lowercase), All other numbers and a characters space are entered. should not be accepted and an error beep Erroneous: should be All other produced. characters are tested following this. (E.g. ], [, /, `)

Actual Result Test Passed? Letters, Yes numbers and spaces are allowed. All other characters are not accepted and an error beep is produced.

Validation Test:

The Normal data was accepted as expected - spaces, backspaces, shift, numbers and letters (both uppercase and lowercase) were accepted. The Erroneous data was not accepted as expected and this produced an error beep.

Dharmesh Tailor

98

F454 Computing Project

Software Development & Testing

Code development: The code to validate the characters entered into the Title field was developed from the algorithm: 12. Perform alphanumeric validation The algorithm has been attached below but can also be found on page 63 in the Algorithms section. 12. Perform alphanumeric validation BEGIN IF Key pressed is NOT Shift, Backspace, Letters (‘A’ to ‘Z’ and ‘a’ to ‘z’), Numbers (‘0’ to ‘9’) Produce error BEEP Key is not allowed to be entered ENDIF END Code to validate characters entered into Title field: procedure Tfrm_DesignView.edt_titleKeyPress(Sender: TObject; var Key: Char); begin if NOT(Key in [#2,#8,'a'..'z','A'..'Z','0'..'9',' ']) then //#2 is for Shift, #8 is for Backspace begin Beep; //Produces an error beep Key := #0; //Prevents the key from being entered end; end;

Dharmesh Tailor

99

F454 Computing Project

Software Development & Testing

10. Validate Characters entered into Author Field What to Test Validate the characters entered into the Author field.

Type of Test Validation - Type Check

Test Data Used

Expected Result Normal: Letters and All letters in the spaces should alphabet (both be allowed. uppercase and All other lowercase) and a characters space are entered. should not be accepted and Erroneous: an error beep should be All other produced. characters including digits are tested following this. (E.g. 6, 1, 7, 9

Actual Result Test Passed? Letters and Yes spaces are allowed. All other characters are not accepted and an error beep is produced.

Validation Test:

The Normal data was accepted as expected - spaces, backspaces, shift and letters (both uppercase and lowercase) were accepted. The Erroneous data was not accepted as expected and this produced an error beep.

Dharmesh Tailor

100

F454 Computing Project

Software Development & Testing

Code development: The code to validate the characters entered into the Author field was developed from the algorithm: 12. Perform alphanumeric validation The algorithm has been attached below but can also be found on page 63 in the Algorithms section. 12. Perform alphanumeric validation BEGIN IF Key pressed is NOT Shift, Backspace, Letters (‘A’ to ‘Z’ and ‘a’ to ‘z’), Numbers (‘0’ to ‘9’) Produce error BEEP Key is not allowed to be entered ENDIF END Code to validate characters entered into Author field: procedure Tfrm_DesignView.edt_authorKeyPress(Sender: TObject; var Key: Char); begin if NOT(Key in [#2,#8,'a'..'z','A'..'Z',' ']) then //#2 is for Shift, #8 is for Backspace begin Beep; //Produces an error beep Key := #0; //Prevents the key from being entered end; end;

Dharmesh Tailor

101

F454 Computing Project

Software Development & Testing

11. Validate Characters entered into ISBN Field What to Test Validate the characters entered into the ISBN field.

Type of Test Validation - Type Check

Test Data Used Normal: Numbers are entered. Erroneous: All other characters including letters are tested following this. (E.g. A, H, q, t)

Expected Result Numbers should be allowed. All other characters should not be accepted and an error beep should be produced.

Actual Result Test Passed? Numbers are Yes allowed. All other characters are not accepted and an error beep is produced.

14. Validate Length of ISBN Field What to Test Validate the length of the IBSN field.

Type of Test Validation - Length Check

Test Data Used Normal: 12 digits are entered . Borderline: The 13th digit is entered.

Expected Result

Actual Result

13 digits should be accepted and the 14th digit should not be accepted and an error beep should be produced.

13 digits are accepted and the 14th digit is not accepted and an error beep is produced.

Test Passed? Yes

Erroneous: More digits are entered. Validation Test: Test 9:

The Normal data was accepted as expected - backspaces, shift and numbers were accepted. The Erroneous data was not accepted as expected and this produced an error beep. Test 12:

The Normal data was accepted – 12 digits inputted successfully.

Dharmesh Tailor

102

F454 Computing Project

Software Development & Testing

The Borderline data was accepted – 13 digits inputted successfully. The Erroneous data was not accepted as expected – I was unable to input any more than 13 digits and an error beep was produced for each additional character entered.

Dharmesh Tailor

103

F454 Computing Project

Software Development & Testing

Code development: The code to validate the characters entered into the ISBN field and the code to validate the length of the ISBN field were developed from the algorithms: 12. Perform alphanumeric validation 13. Perform a length check validation The algorithms have been attached below but can also be found on page 63 and 64 in the Algorithms section. 12. Perform alphanumeric validation BEGIN IF Key pressed is NOT Shift, Backspace, Letters (‘A’ to ‘Z’ and ‘a’ to ‘z’), Numbers (‘0’ to ‘9’) Produce error BEEP Key is not allowed to be entered ENDIF END 13. Perform a length check validation BEGIN IF Length of Publisher Textbox > 19 Produce error BEEP Key is not allowed to be entered ENDIF END Code to validate length and characters entered into IBSN field: procedure Tfrm_DesignView.edt_isbnKeyPress(Sender: TObject; var Key: Char); begin if NOT(Key in [#8,'0'..'9']) then //#8 is for Backspace begin Beep; //Produces an error beep Key := #0; //Prevents the key from being entered end; if (Length(edt_isbn.Text) > 12) and (Key chr(8)) then begin Beep; //Produces an error beep Key := #0; //Prevents the key from being entered end; end;

Dharmesh Tailor

104

F454 Computing Project

Software Development & Testing

12. Validate Characters entered into Publisher Field What to Test Validate the characters entered into the Publisher field.

Type of Test Validation - Type Check

Test Data Used

Expected Result Normal: Letters and All letters in the spaces should alphabet (both be allowed. uppercase and All other lowercase) and a characters space are entered. should not be accepted and Erroneous: an error beep should be All other produced. characters including digits are tested following this. (E.g. 4, 1, 9, 7)

Actual Result Test Passed? Letters and Yes spaces are allowed. All other characters are not accepted and an error beep is produced.

Validation Test:

The Normal data was accepted as expected - spaces, backspaces, shift and letters (both uppercase and lowercase) were accepted. The Erroneous data was not accepted as expected and this produced an error beep.

Dharmesh Tailor

105

F454 Computing Project

Software Development & Testing

Code development: The code to validate the characters entered into the Publisher field was developed from the algorithm: 12. Perform alphanumeric validation The algorithm has been attached on the next page but can also be found on page 63 in the Algorithms section. 12. Perform alphanumeric validation BEGIN IF Key pressed is NOT Shift, Backspace, Letters (‘A’ to ‘Z’ and ‘a’ to ‘z’), Numbers (‘0’ to ‘9’) Produce error BEEP Key is not allowed to be entered ENDIF END Code to validate characters entered into Publisher field: procedure Tfrm_DesignView.edt_publisherKeyPress(Sender: TObject; var Key: Char); begin if NOT(Key in [#2,#8,'a'..'z','A'..'Z',' ']) then //#8 is for Backspace begin Beep; //Produces an error beep Key := #0; //Prevents the key from being entered end; end;

Dharmesh Tailor

106

F454 Computing Project

Software Development & Testing

13. Populate the Format Combo Box What to Test Populate the Format Combo Box.

Type of Test Black Box

Test Data Used Click the Format Combo Box.

Expected Result The combo box is populated.

Actual Result The combo box is populated.

Test Passed? Yes

Black Box Test:

The combo box is populated on form create. Code to populate Format Combo Box procedure Tfrm_DesignView.FormCreate(Sender: TObject); begin //The strings are added to the Format Combo Box cmb_format.Items.Add('Paperback'); cmb_format.Items.Add('Hardback'); cmb_format.Items.Add('Spiral-bound'); end;

Dharmesh Tailor

107

F454 Computing Project

Software Development & Testing

15. Presence Check What to Test Presence Check

Type of Test Validation

Test Data Used The Title, Author, Category, Room and ISBN fields are empty and the Save Record button is pressed.

Expected Result Information messages should be displayed for each field and the fields should be highlighted red.

Actual Result Information messages are displayed for each field and the fields are highlighted red.

Test Passed? Yes

Black Box Test:

Missing fields are highlighted red

Dharmesh Tailor

108

F454 Computing Project

Software Development & Testing

Information Message displayed if the Room Combo Box is blank.

Information Message displayed if the Title field is blank.

Information Message displayed if the Author field is blank.

Information Message displayed if the Category Combo Box is blank.

Information Message displayed if the ISBN field is blank.

The presence check is performed on the Title, Author, Category, Room and ISBN fields when the Save Record Button is selected. If the field is left blank, it will be highlighted red and an information message will be displayed.

Dharmesh Tailor

109

F454 Computing Project

Software Development & Testing

Code development: The code to perform a presence check was developed from the algorithm: 9. Save a record The algorithm has been attached below but can also be found on page 61 in the Algorithms section. 9. Save a record BEGIN Declare boolean variable Don’t Save Don’t Save = False IF Room Combo box Item Index = -1 Don’t Save = True DISPLAY Information Message (‘Room is missing’) Room Combo box Colour = Red ELSE Room Combo Box Colour = Default ENDIF IF Title Textbox = ‘’ Don’t Save = True DISPLAY Information Message (‘Title is missing’) Title Textbox Colour = Red ELSE Title Textbox Colour = Default ENDIF IF Author Textbox = ‘’ Don’t Save = True DISPLAY Information Message (‘Author is missing’) Author Textbox Colour = Red ELSE Author Textbox Colour = Default ENDIF IF Category Combo box Item Index = -1 Don’t Save = True DISPLAY Information Message (‘Category is missing’) Category Combo box Colour = Red ELSE Category Combo Box Colour = Default ENDIF IF ISBN Textbox = ‘’ Don’t Save = True DISPLAY Information Message (‘ISBN is missing’) ISBN Textbox Colour = Red ELSE ISBN Textbox Colour = Default ENDIF IF Don’t Save = False Save Record of Current Record Number IF Current Record Number > Total Number of Records INCREMENT Total Number of Records ENDIF DISPLAY Information Message (‘Record Saved’) DISPLAY Record of Current Record Number ENDIF END

Dharmesh Tailor

110

F454 Computing Project

Software Development & Testing

The following is an example of how, through a combination of software development and testing, I overcame a problem during the development of the system. The end result is more efficient than the original code and the original errors have been eliminated. Original: Code to perform presence check I have attached below the original code I developed to perform a presence check. procedure Tfrm_DesignView.btn_saverecordClick(Sender: TObject); var DontSave : Boolean; begin DontSave := False; if (cmb_room.itemindex = -1) then DontSave := True; MessageDlg('Room is missing.',mtInformation, [mbOK], 0); cmb_room.Color := clred; else cmb_room.Color := cldefault; if (edt_title.Text = '') then DontSave := True; MessageDlg('Title is missing.',mtInformation, [mbOK], 0); edt_title.Color := clred; else edt_title.Color := cldefault; if (edt_author.Text = '') then DontSave := True; MessageDlg('Author is missing.',mtInformation, [mbOK], 0); edt_author.Color := clred; else edt_author.Color := cldefault; if (cmb_category.ItemIndex = -1) then DontSave := True; MessageDlg('Category is missing.',mtInformation, [mbOK], 0); cmb_category.Color := clred; else cmb_category.Color := cldefault; if (edt_isbn.text = '') then DontSave := True; MessageDlg('ISBN is missing.',mtInformation, [mbOK], 0); edt_isbn.Color := clred; else edt_isbn.Color := cldefault; end;

Dharmesh Tailor

111

F454 Computing Project

Software Development & Testing

As the system was developed, I tested every major implementation. I have attached below evidence of the testing for the Presence Check procedure. Alpha Testing – Black Box Test:

Error during execution of Presence check code

Dharmesh Tailor

112

F454 Computing Project

Software Development & Testing

Final: Code to perform presence check Following the testing of the initial presence check code, I have added a begin and an end between all IF statements. This has made the code more comprehensible and has reduced the number of errors. procedure Tfrm_DesignView.btn_saverecordClick(Sender: TObject); var //If any of the fields are blank, the record is not saved DontSave : Boolean; begin DontSave := False; Begin added if (cmb_room.itemindex = -1) then begin DontSave := True; //Prevents record being saved //Displays information message MessageDlg('Room is missing.',mtInformation, [mbOK], 0); //If field is empty, it is highlighted red cmb_room.Color := clred; End added end else begin cmb_room.Color := cldefault; end; if (edt_title.Text = '') then begin DontSave := True; MessageDlg('Title is missing.',mtInformation, [mbOK], 0); edt_title.Color := clred; end else begin edt_title.Color := cldefault; end; if (edt_author.Text = '') then begin DontSave := True; MessageDlg('Author is missing.',mtInformation, [mbOK], 0); edt_author.Color := clred; end else begin edt_author.Color := cldefault; end; if (cmb_category.ItemIndex = -1) then begin DontSave := True; MessageDlg('Category is missing.',mtInformation, [mbOK], 0); cmb_category.Color := clred; end else begin cmb_category.Color := cldefault; end; if (edt_isbn.text = '') then begin DontSave := True; MessageDlg('ISBN is missing.',mtInformation, [mbOK], 0); edt_isbn.Color := clred;

Dharmesh Tailor

113

F454 Computing Project

Software Development & Testing

end else begin edt_isbn.Color := cldefault; end; end;

Dharmesh Tailor

114

F454 Computing Project

Software Development & Testing

16. Save Record What to Test Save Record

Type of Test Black Box and White Box

Test Data Used All fields are entered with valid data and the Save Record button is pressed.

Expected Result The record is saved and an information message is displayed confirming this. The fields are all disabled and their readonly property is set to true.

Actual Result The record is saved and an information message is displayed confirming this. The fields are all disabled and their readonly property is set to true.

Test Passed? Yes

Black Box Test:

Save Record button selected

Fields filled with valid data

Information message displayed confirming record has been successfully saved

Dharmesh Tailor

115

F454 Computing Project

Software Development & Testing

White Box Testing:

The Book ID field has been saved successfully for the 2nd record.

Array of Library Records

The other fields are empty because the data for them hasn’t been saved yet.

The Title field has been saved successfully for the 2nd record.

Dharmesh Tailor

116

F454 Computing Project

Software Development & Testing

The Category field has been saved successfully for the 2nd record.

The Comments field has been saved successfully for the 2nd record.

Dharmesh Tailor

117

F454 Computing Project

Software Development & Testing

Code to save record: procedure SaveRecord (RecordNumber : integer); //Saves the record begin with frm_DesignView do begin //This procedure writes the contents of each edit box into the array at the parameter location LibraryRecords[RecordNumber].BookID := StrToInt(edt_bookid.Text); libraryRecords[RecordNumber].Room := cmb_room.Text; LibraryRecords[RecordNumber].Title := edt_title.Text; LibraryRecords[RecordNumber].Author := edt_author.Text; LibraryRecords[RecordNumber].Category := cmb_category.Text; LibraryRecords[RecordNumber].ISBN := edt_isbn.Text; LibraryRecords[RecordNumber].Publisher := edt_publisher.Text; LibraryRecords[RecordNumber].Format := cmb_format.Text; LibraryRecords[RecordNumber].Comments := memo_comments.Text; end; end;

Dharmesh Tailor

118

F454 Computing Project

Software Development & Testing

17. Save File What to Test Save File

Type of Test

Test Data Used

Expected Result

Actual Result

Test Passed?

Black Box and White Box

Four valid records are saved and the Save File button is pressed.

The file is saved and an information message is displayed confirming this.

The file is saved and an information message is displayed confirming this.

Yes

Black Box Test:

Save File button selected

Information message displayed confirming file has been successfully saved

Dharmesh Tailor

119

F454 Computing Project

Software Development & Testing

White Box Test:

Records will be written to the LibraryDatabase .dat File

This goes through each record in the LibraryRecords array.

This rewrites the LibraryDatabase .DAT File with the records saved in the LibraryRecords array. The 1st record in the Library Records array has been successfully saved to the LibraryDatabase .DAT File.

Dharmesh Tailor

120

F454 Computing Project

Software Development & Testing

The 2nd record in the Library Records array has been successfully saved to the LibraryDatabase .DAT File.

Contents of LibraryDatabase.DAT:

The 1st record saved in the file.

The 2nd record saved in the file.

Delimiters are added to the File by the system in order to separate out the fields.

Dharmesh Tailor

121

F454 Computing Project

Software Development & Testing

Code development: The code to save the file was developed from the algorithm: 10. Save the file The algorithm has been attached on the next page but can also be found on page 63 in the Algorithms section. 10. Save the file BEGIN Declare integer variable Count ASSIGN Library File as LibraryDatabase.DAT File REWRITE Library File FOR Count = 1 to Total Number of Records WRITE the Library Records (Count) into the Library File ENDFOR CLOSE Library File DISPLAY Information Message (‘File Saved.’) END Code to save file: This procedure rewrites the contents of the LibraryRecords array into the LibraryDatabase.DAT File. procedure Tfrm_DesignView.btn_savefileClick(Sender: TObject); var Count : Integer; begin AssignFile(LibraryFile,'LibraryDatabase.dat'); rewrite(LibraryFile); //This goes through each record in the LibraryRecords array for Count := 1 to TotalNoOfRecords do begin //This writes each record into the LibraryFile write(LibraryFile,LibraryRecords[Count]); end; CloseFile(LibraryFile); MessageDlg('File Saved.',mtInformation,[mbOK],0); end;

Dharmesh Tailor

122

F454 Computing Project

Software Development & Testing

6. Populate fields with records from LibraryDatabase.DAT What to Test

Type of Test

Test Data Used

Expected Result

Actual Result

Test Passed?

Populate fields with records from LibraryD atabase. DAT file.

Black Box

The fields will be initially filled with data and saved to file. The program will be restarted to test whether the records will be read back into the system.

The fields are populated with data from the LibraryData base.DAT file.

Yes The fields are populated with data from the LibraryDatabase .DAT file.

Black Box Test:

Records saved in the LibraryDatabase.DAT file.

The fields have been populated with the data from the 1st record, stored in the LibraryDatabase. DAT file

Dharmesh Tailor

123

F454 Computing Project

Software Development & Testing

Code development: The code to populate the fields with the records stored in the LibraryDatabase.DAT file were developed from the algorithms: 2. Read the Library File into the system 4. Display the records The algorithms have been attached below but can also be found on page 59 in the Algorithms section. 2. Read the Library File into the system BEGIN Total Number of Records = 0 ASSIGN Library File as LibraryDatabase.DAT File RESET Library File WHILE not at the end of the Library File INCREMENT Total Number of Records READ the currently selected field in the Library File into the currently selected Library Record ENDWHILE CLOSE Library File Current Record Number = 1 Display records of the Current Record Number END 4. Display the records BEGIN Book ID Textbox = Book ID of the Current Record in the Library Records Room Combo box = Room of the Current Record in the Library Records Title Textbox = Title of the Current Record in the Library Records Author Textbox = Author of the Current Record in the Library Records Category Combo box = Category of the Current Record in the Library Records ISBN Textbox = ISBN of the Current Record in the Library Records Publisher Textbox = Publisher of the Current Record in the Library Records Format Combo box = Format of the Current Record in the Library Records Comments Textbox = Comments of the Current Record in the Library Records Current Record Number Label = Current Record Number Total Number of Records Label = Total Number of Records END

Dharmesh Tailor

124

F454 Computing Project

Software Development & Testing

Code to populate fields with records stored in LibraryDatabase.DAT: The following procedure reads the records stored in the LibraryDatabase.DAT file into the Library Records array. It then calls the Display procedure (see next page). procedure Tfrm_DesignView.FormCreate(Sender: TObject); var i : Integer; begin //Sets the Total Number of Records variable to 0 TotalNoOfRecords := 0; //Assigns the Library File to the LibraryDatabase.dat file AssignFile(LibraryFile, 'LibraryDatabase.dat'); Reset(LibraryFile); //This reads in each record from the LibraryFile into the Library Records Array while NOT EOF(LibraryFile) do begin inc(TotalNoOfRecords); read(LibraryFile, LibraryRecords[TotalNoOfRecords]); end; CloseFile(LibraryFile); //The Current Record Number variable is set to the first record CurrentRecordNo := 1; //This runs the Display procedure using the Current Record Number as the parameter. //The fields are filled with data from the Library File. Display(CurrentRecordNo); end;

The following procedure populates the fields with the data at the specified parameter in the Library Records Array. procedure Display (RecordNumber : integer); begin with frm_DesignView do begin //This displays the contents of the Library File at the parameter location into the edit boxes edt_bookid.Text := IntToStr(LibraryRecords[RecordNumber].BookID); cmb_room.Text := LibraryRecords[RecordNumber].Room; edt_title.Text := LibraryRecords[RecordNumber].Title; edt_author.Text := LibraryRecords[RecordNumber].Author; cmb_category.Text := LibraryRecords[RecordNumber].Category; edt_isbn.Text := LibraryRecords[RecordNumber].ISBN; edt_publisher.Text := LibraryRecords[RecordNumber].Publisher; cmb_format.Text := LibraryRecords[RecordNumber].Format; memo_comments.Text := LibraryRecords[RecordNumber].Comments; //This updates the labels for the Current Record Number and the Total Number of Records edt_currentrecordno.Caption := IntToStr(CurrentRecordNo); lbl_totalnoofrecords.caption := inttostr(TotalNoOfRecords); end; end;

Dharmesh Tailor

125

F454 Computing Project

Software Development & Testing

18. New Record What to Test New Record

Type of Test Black Box

Test Data Used The New Record button is pressed.

Expected Result

Actual Result

All fields are blanked. The Current Record Number is incremented. The fields are all enabled and their read-only property is set to false.

All fields are blanked. The Current Record Number is incremented. The fields are all enabled and their read-only property is set to false.

Test Passed? Yes

Black Box Test:

New Record button selected

Current Record Number incremented

All the fields are blanked

Code development; The code to create a new record was developed from the algorithm: 8. Create a new record The algorithm has been attached on the next page but can also be found on page 61 in the Algorithms section.

Dharmesh Tailor

126

F454 Computing Project

Software Development & Testing

8. Create a new record BEGIN Current Record Number = Total Number of Records + 1 Current Record Number Label = Current Record Number IF Total Number of Records = 0 Book ID Textbox = 1 ELSE Book ID Textbox = Total Number of Records + 1 ENDIF Room Combo box Item Index = -1 Title Textbox = ‘’ Author Textbox = ‘’ Category Combo box Item Index = -1 ISBN Textbox = ‘’ Publisher Textbox = ‘’ Format Combo box Item Index = -1 Comments Text box = ‘’ END Code to create new record: procedure Tfrm_DesignView.btn_newrecordClick(Sender: TObject); begin //This sets the array pointer to move by 1 place in the array CurrentRecordNo := TotalNoOfRecords + 1; //This fills the book ID edit box with a value depending on the total number of records edt_currentrecordno.Caption := IntToStr(CurrentRecordNo); if TotalNoOfRecords = 0 then begin //Sets the Book ID to 1 if there are no records edt_bookid.Text := IntToStr(1); end else begin //Sets the Book ID to be the last records Book ID + 1 edt_bookid.Text := IntToStr((LibraryRecords[TotalNoOfRecords].BookID) + 1); //This clears the contents of each field cmb_room.ItemIndex := -1; edt_title.Text := ''; edt_author.Text := ''; cmb_category.ItemIndex := -1; edt_isbn.Text := ''; edt_publisher.Text := ''; cmb_format.ItemIndex := -1; memo_comments.Text := ''; end; end;

Dharmesh Tailor

127

F454 Computing Project

Software Development & Testing

19. Edit Record What to Test Edit Record

Type of Test Black Box

Test Data Used The second record is displayed and the Edit Record button is pressed.

Expected Result The fields are all enabled and their read-only property is set to false.

Actual Result The fields are all enabled and their read-only property is set to false.

Test Passed? Yes

Black Box Test:

All the buttons apart from the Save Record button are disabled.

All the fields are enabled for editing.

Dharmesh Tailor

128

F454 Computing Project

Software Development & Testing

Code to edit record: procedure Tfrm_DesignView.btn_editrecordClick(Sender: TObject); begin //This prevents scrolling using the Up Down Object UpDown1.Enabled := False; // This prevents scrolling using the mouse wheel Scroll := False; //This makes the Cancel button visible so that the user can cancel editing the current record btn_cancel.Visible := True; //This enables the save record button and disables the other buttons btn_saverecord.Enabled := True; btn_newrecord.Enabled := False; btn_editrecord.Enabled := False; btn_savefile.Enabled := False; btn_deleterecord.Enabled := False; btn_close.Enabled := False; //This prevents access to the report form btn_reportview.Enabled := False; //This disenables the Report View form frm_ReportView.Enabled := False; //This procedure enables all the fields EnableFields; end;

The following code enables all the fields so that they can be edited. procedure EnableFields; begin with frm_DesignView do begin //This enables all the fields apart from the Book ID field edt_title.ReadOnly := False; cmb_room.Enabled := True; edt_author.ReadOnly := False; cmb_category.Enabled := True; edt_isbn.ReadOnly := False; edt_publisher.ReadOnly := False; cmb_format.Enabled := True; memo_comments.ReadOnly := False; end; end;

Dharmesh Tailor

129

F454 Computing Project

Software Development & Testing

20. Next Record What to Test Next Record

Type of Test Black Box

Test Data Used The mouse scroll wheel is scrolled downwards.

Expected Result The next record is displayed and the Current Record Number is incremented.

Actual Result The next record is displayed and the Current Record Number is incremented.

Test Passed? Yes

Black Box Test: Before test:

The 1st record, by default, is displayed when the form is opened. To navigate to the next record, the mouse wheel can be scrolled downwards or the Up Down object can be used as shown.

Fields are filled with data from 1st record

Dharmesh Tailor

130

F454 Computing Project

Software Development & Testing

After test:

Current Record Number incremented

Fields are refilled with data from 2nd record

Dharmesh Tailor

131

F454 Computing Project

Software Development & Testing

Code development: The code to navigate to the next record was developed from the algorithm: 11. Record navigation The algorithm has been attached below but can also be found on page 63 in the Algorithms section. 11. Record navigation BEGIN IF Current Record Number < Total Number of Records INCREMENT Current Record Number DISPLAY Record of the Current Record Number ENDIF END Code to navigate to next record: procedure Tfrm_DesignView.FormMouseWheelDown(Sender: TObject); begin //If Scroll is set to True then user can navigate to the next record if Scroll then begin if CurrentRecordNo < TotalNoOfRecords then begin //This moves the array pointer up 1 record inc(CurrentRecordNo); //This runs the Display procedure carrying the array pointer location as a parameter Display(CurrentRecordNo); end; end; end;

Dharmesh Tailor

132

F454 Computing Project

Software Development & Testing

21. Previous Record What to Test Previous Record

Type of Test Black Box

Test Data Used The mouse scroll wheel is scrolled upwards.

Expected Result

Actual Result

The previous record is displayed and the Current Record Number is decremented.

The previous record is displayed and the Current Record Number is decremented.

Test Passed? Yes

Black Box Test: Before test:

The 2nd record is displayed. To navigate to the previous record, the mouse wheel can be scrolled upwards or the Up Down object can be used as shown.

Fields are filled with data from 2nd record

Dharmesh Tailor

133

F454 Computing Project

Software Development & Testing

After test:

Current Record Number decremented

Fields are refilled with data from 1st record

Dharmesh Tailor

134

F454 Computing Project

Software Development & Testing

Code development; The code to navigate to the next record was developed from the algorithm: 11. Record navigation The algorithm has been attached below but can also be found on page 63 in the Algorithms section. 11. Record navigation BEGIN IF Current Record Number > 1 DECREMENT Current Record Number DISPLAY Record of the Current Record Number ENDIF END Code to navigate to previous record: procedure Tfrm_DesignView.FormMouseWheelUp(Sender: TObject); begin //If Scroll is set to True then user can navigate to the previous record if Scroll then begin if CurrentRecordNo > 1 then begin //This moves the array pointer down 1 record dec(CurrentRecordNo); //This runs the Display procedure carrying the array pointer location as a parameter Display(CurrentRecordNo); end; end; end;

Dharmesh Tailor

135

F454 Computing Project

Software Development & Testing

22. Delete Record What to Test Delete Record

Type of Test Black Box

Test Data Used The second record is displayed and the Delete Record Button is pressed.

Expected Result

Actual Result

The user is asked whether they are sure they want to delete the currently selected record. If ‘Yes’ is selected, then the record is deleted and the Current Record Number and Total Number of Records are decremented. An information message is displayed after the record has been successfully deleted.

The user is asked whether they are sure they want to delete the currently selected record. When ‘Yes’ is selected, the record is deleted and the Current Record Number and Total Number of Records are decremented. An information message is displayed after the record has been successfully deleted.

Test Passed? Yes

Black Box Test: Delete Record button selected

Confirmation dialog showed asking user whether they are sure they want to delete the record

Yes is selected

Dharmesh Tailor

136

F454 Computing Project

Software Development & Testing

Current Record Number decremented

Information dialog alerting user that the delete was successful

The 2nd record has been deleted and removed from the LibraryDatabse.DAT File (after the Save File button is pressed).

Dharmesh Tailor

137

F454 Computing Project

Software Development & Testing

Code development: The code to navigate to the next record was developed from the algorithm: 7. Delete a record The algorithm has been attached below but can also be found on page 60 in the Algorithms section. 7. Delete a record BEGIN Declare integer variable Count DISPLAY Warning Message (‘Are you sure you want to delete this record?’) IF No EXIT ENDIF ELSE IF Current Record Number = 1 AND Total Number of Records > 1 FOR Count = Current Record Number to Total Number of Records – 1 Library Records (Count) = Library Records (Count + 1) ENDFOR DECREMENT Total Number of Records DISPLAY Record of the Current Record Number DISPLAY Information Message (‘Record deleted’) EXIT ENDIF IF Current Record Number = 1 and Total Number of Records = 1 DECREMENT Total Number of Records DECREMENT Current Record Number DISPLAY Record of the Current Record Number DISPLAY Information Message (‘File is now empty’) EXIT ENDIF FOR Count = Current Record Number to Total Number of Records – 1 Library Records (Count) = Library Records (Count + 1) ENDFOR DECREMENT Total Number of Records DECREMENT Current Record Number DISPLAY Record of the Current Record Number DISPLAY Information Message (‘Record deleted’) END

Dharmesh Tailor

138

F454 Computing Project

Software Development & Testing

The following is an example of how, through a combination of software development and testing, I overcame a problem during the development of the library system. The end result is more efficient than the original code and the original errors have been eliminated. Original: Code to delete record I have attached below the original code I developed to delete a record. procedure Tfrm_DesignView.btn_deleterecordClick(Sender: TObject); var Count, ButtonSelected : Integer; begin ButtonSelected := MessageDlg('Are you sure you wish to delete this record?',mtWarning,[mbYes,mbNo],0); if ButtonSelected = mrNo then exit; if ButtonSelected = mrYes then if (CurrentRecordNo = 1) and (TotalNoOfRecords > 1) then for Count := CurrentRecordNo to TotalNoOfRecords - 1 do LibraryRecords[Count] := LibraryRecords[Count + 1]; dec(TotalNoOfRecords); Display(CurrentRecordNo); MessageDlg('First record deleted.',mtInformation,[mbOK],0); exit; if (CurrentRecordNo = 1) and (TotalNoOfRecords = 1) then dec(TotalNoOfRecords); dec(CurrentRecordNo); Display(CurrentRecordNo); MessageDlg('File is now Empty.',mtInformation,[mbOK],0); exit; for Count := CurrentRecordNo to TotalNoOfRecords - 1 do LibraryRecords[Count] := LibraryRecords[Count+1]; dec(TotalNoOfRecords); dec(CurrentRecordNo); Display(CurrentRecordNo); MessageDlg('Record Deleted.',mtInformation,[mbOK],0); btn_savefile.Enabled := True; end;

Dharmesh Tailor

139

F454 Computing Project

Software Development & Testing

As the system was developed, I tested every major implementation. I have attached below evidence of the testing for the Delete Record procedure. Alpha Testing - Black Box Test:

Delete Record Button selected

Confirmation dialog showed asking user whether they are sure they want to delete the record

Yes is selected

Information dialog alerting user that the delete was successful however record has not been deleted

Dharmesh Tailor

140

F454 Computing Project

Software Development & Testing

Alpha Testing – White BoxTest:

‘Yes’ is selected on the Confirmation Dialog

The Current Record Number is 2 so the IF Statement should not be executed.

Dharmesh Tailor

141

F454 Computing Project

Software Development & Testing

This line is not executed as the Current Record Number is greater than 1. Therefore, the record is not deleted

This line, however, is executed and the Total Number of Records variable is decremented unnecessarily.

The record of the Current Record Number is displayed. This record however is already displayed.

Dharmesh Tailor

142

F454 Computing Project

Software Development & Testing

Message dialog incorrectly informing user that record has been deleted.

Procedure ends. Record is not deleted.

Dharmesh Tailor

143

F454 Computing Project

Software Development & Testing

Final: Code to delete record Following the testing of the initial delete record code, I have added a begin and an end between IF statements. This has made the code more comprehensible and has reduced the number of errors. procedure Tfrm_DesignView.btn_deleterecordClick(Sender: TObject); //This procedure deletes the currently selected record var Count, ButtonSelected : Integer; begin //Shows a confirmation dialog asking user whether they want to delete the record ButtonSelected := MessageDlg('Are you sure you wish to delete this record?',mtWarning,[mbYes,mbNo],0); //Show the button type selected if ButtonSelected = mrNo then exit; if ButtonSelected = mrYes then begin //If there are more than one record in the array if (CurrentRecordNo = 1) and (TotalNoOfRecords > 1) then begin for Count := CurrentRecordNo to TotalNoOfRecords - 1 do begin //Shuffle up remaining records LibraryRecords[Count] := LibraryRecords[Count + 1]; end; dec(TotalNoOfRecords); Display(CurrentRecordNo); //Informs the user that the delete was successful MessageDlg('First record deleted.',mtInformation,[mbOK],0); exit end; //If there is only one record in the array if (CurrentRecordNo = 1) and (TotalNoOfRecords = 1) then begin dec(TotalNoOfRecords); dec(CurrentRecordNo); Display(CurrentRecordNo); //Informs the user that the array is empty MessageDlg('File is now Empty.',mtInformation,[mbOK],0); exit end; begin for Count := CurrentRecordNo to TotalNoOfRecords - 1 do begin //This shuffles up remaining records LibraryRecords[Count] := LibraryRecords[Count+1]; end; dec(TotalNoOfRecords); dec(CurrentRecordNo); Display(CurrentRecordNo); //Informs the user that the delete was successful MessageDlg('Record Deleted.',mtInformation,[mbOK],0); end; //Enables the Save File button btn_savefile.Enabled := True; end; end;

Dharmesh Tailor

144

F454 Computing Project

Software Development & Testing

23. Open the Report View form What to Test

Type of Test

Test Data Used

Expected Result

Actual Result

Open the Report View form

Black Box

The Report View button is pressed.

The Report View form is displayed.

The Report View form is displayed.

Test Passed? Yes

Black Box Test:

Report View button pressed

The Report View form is displayed however the objects on the form have not been coded yet therefore they have no functionality.

Dharmesh Tailor

145

F454 Computing Project

Software Development & Testing

Code to open the Report View form: procedure Tfrm_DesignView.btn_reportviewClick(Sender: TObject); begin frm_ReportView.Show; end;

Dharmesh Tailor

146

F454 Computing Project

Software Development & Testing

24. Close Application with Open Records What to Type of Test Test Close Black Box Application with Open Records

Test Data Used The first record is displayed and the Edit Record button is pressed. The Close button is pressed.

Expected Result An information message will appear telling the user to close any unsaved records.

Actual Result An information message appears telling the user to close any unsaved records.

Test Passed? Yes

Black Box Test: Close button pressed

Information message informing the user to save or cancel any open records

Code to close application with open records: procedure Tfrm_DesignView.FormCloseQuery(Sender: TObject); begin //This checks whether there are any records open if ProgramClose then begin //This executes the Close Button procedure btn_closeClick(Self); end else begin //Displays information message informing user to save or cancel any open records ShowMessage('Please save or cancel any open records.'); end; end;

Dharmesh Tailor

147

F454 Computing Project

Software Development & Testing

25. Close application What to Type of Test Test Close Black Box Application

Test Data Used The Close Button is pressed.

Expected Result

Actual Result

A confirmation dialog box will appear asking the user if they are sure they want to close the application. If ‘Yes’ is selected then the application is closed.

A confirmation dialog box appears asking the user if they are sure they want to close the application. When ‘Yes’ is selected, the application is closed.

Test Passed? Yes

Black Box Test:

Confirmation dialog asking user whether they want to exit the application in case they have forgotten to save their changes

Close button pressed

Dharmesh Tailor

148

F454 Computing Project

Software Development & Testing

Code to close application: procedure Tfrm_DesignView.btn_closeClick(Sender: TObject); begin //Confirmation dialog asking user whether they want to exit the application if MessageDlg('Are you sure you want to exit the application?',mtConfirmation,[mbYes,mbNo],0) = mrYes then begin Application.Terminate; //Terminates the application end; end;

Dharmesh Tailor

149

F454 Computing Project

Software Development & Testing

Beta Testing – Design View Form At this point in the development of the system, all the main functions of the Design View form have been coded and thoroughly tested. However, several key features of the system have not yet been produced. The Report View form has not been coded yet and this module contains many major features including the loading of records into a table and printing of the records. Regardless, I felt it would be beneficial to send the system as it stands to the end user, pointing out any features that have not been produced yet. My end user will be able to notify me of any interface problems or any unexpected errors that occur which can then be fixed before submitting the final solution. I have attached the letter I received from my end user below.

Dharmesh Tailor

150

F454 Computing Project

Software Development & Testing

The bug is one that I had not spotted or tested for. I have been able to reproduce the bug below.

Delete Record Button selected

Information dialog alerting user that the delete was successful even though there was no record to delete

If there are one or more records in the Library Records array then the code works as expected with the record successfully being deleted. However, if the array is empty and the Delete Record button is pressed followed by ‘Yes’ being selected for the confirmation dialog, then the code is still followed through with the Total Number of Records and Current Record Number integers being decremented. This can cause problems when creating new records and when saving the array to file. To solve the problem, I made a small modification to the Delete Record code. Before asking the user whether they wish to delete the record, the array is checked first to see if it is empty. If it is empty then a message dialog is displayed informing the user otherwise the code executes as normal. begin //If the LibraryRecords array is empty if TotalNoOfRecords = 0 then begin //If there are no records and the user selects delete then the user is informed MessageDlg('File is empty. Cannot delete.',mtError,[mbOK],0); exit; end; //Shows a confirmation dialog asking user whether they want to delete the record ButtonSelected := MessageDlg('Are you sure you wish to delete this record?',mtWarning,[mbYes,mbNo],0);

Dharmesh Tailor

151

F454 Computing Project

Software Development & Testing

Delete Record Button selected when the Library Records array is empty.

Error message informing the user that the file is empty, preventing any further errors.

Dharmesh Tailor

152

F454 Computing Project

Software Development & Testing

Section Two: Library Database Report View This unit deals with the loading of saved records into a table, highlighting a particular record and viewing it in the Design View, and the sorting, searching and printing of records. The following table has been taken from the test strategy in the Design section, however with each test’s outcome. Each test will be documented in more detail further in the report. Test No. 26

What to Test

27

Populate Search Combo Box Populate Sort Combo Box

28

Fill String Grid Column Headers

Type of Test Black Box

Test Data Used The Report View form is loaded.

Black Box

Click the Search Combo Box Click the Sort Combo Box

Black Box

29

Load Records Black Box into String Grid

The ‘All’ option is selected in the Radio Group.

30

Fill List Box with Rooms

Black Box

The ‘Rooms’ option is selected in the Radio Group.

31

Fill List Box with Categories

Black Box

The ‘Categories’ option is selected in the Radio Group.

32

Load Records of particular Room into String Grid

Black Box

The ‘Rooms’ option is selected in the Radio Group. The room, ‘Dr Tailor’s Room’, is selected in the List Box.

Dharmesh Tailor

Expected Result The String Grid is filled with column headers on form create. The combo box is populated on form create. The combo box is populated on form create. The String Grid is filled with the records saved in the LibraryDatabase. DAT file. The List Box is filled with the list of rooms saved in the room.TXT file. The List Box is filled with the list of categories saved in the category.TXT file. The String Grid is filled with the records whose Room field is ‘Dr Tailor’s Room’.

Actual Result

Test Passed? The String Grid is Yes filled with column headers on form create. The combo box is Yes populated on form create. The combo box is Yes populated on form create. The String Grid is Yes filled with the records saved in the LibraryDatabase. DAT file. The List Box is Yes filled with the list of rooms saved in the room.TXT file. The List Box is Yes filled with the list of categories saved in the category.TXT file. The String Grid is Yes filled with the records whose Room field is ‘Dr Tailor’s Room’.

153

F454 Computing Project

Software Development & Testing

33

Load Records of particular Category into String Grid

Black Box

34

Load record into Design View Form

Black Box

35

Search Record

Black Box

36

Sort Records Alphabetically

Black Box

37

Sort Records Numerically

Black Box

Select the ISBN field in the Sort Combo Box.

38

Print Report

Black Box

Print Button is pressed.

Dharmesh Tailor

The ‘Categories’ option is selected in the Radio Group. The category, ‘Infectious Diseases’, is selected in the List Box. The ‘All’ option is selected in the Radio Group. The second record in the String Grid is selected. Select the Title field in the Search Combo Box. Enter ‘Ox’ in the Search Textbox. Select the Author field in the Sort Combo Box.

The String Grid is filled with the records whose Category field is ‘Infectious Diseases’.

The String Grid is Yes filled with the records whose Category field is ‘Infectious Diseases’.

The record selected is loaded into the Design View Form.

The record selected is loaded into the Design View Form.

Yes

The record titled ‘Oxford Handbook of Infectious Diseases’ should be highlighted.

The record titled ‘Oxford Handbook of Infectious Diseases’ is highlighted.

Yes

The records should be sorted alphabetically ascending according to the Author field. The records should be sorted numerically ascending according to the ISBN field. A report of the records loaded into the String Grid is generated and this is printed. An information message is displayed confirming this.

The records are sorted alphabetically ascending according to the Author field. The records are sorted numerically ascending according to the ISBN field. A report of the records loaded into the String Grid is generated and this is printed. An information message is displayed confirming this.

Yes

154

Yes

Yes

F454 Computing Project

39

Close Form

Black Box

Dharmesh Tailor

Software Development & Testing

Close Button is pressed.

A confirmation dialog box will appear asking the user if they are sure they want to close the form. If ‘Yes’ is selected then the form is closed.

A confirmation dialog box appears asking the user if they are sure they want to close the form. When ‘Yes’ is selected, the form is closed.

155

Yes

F454 Computing Project

Software Development & Testing

Unit Declaration of Variables and Procedures unit Unit3; {$mode objfpc} interface uses Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs, StdCtrls, Grids, ExtCtrls, ComObj, Printers, PrintersDlgs; type { Tfrm_ReportView } Tfrm_ReportView = class(TForm) btn_close: TButton; btn_help: TButton; btn_print: TButton; cmb_search: TComboBox; cmb_sort: TComboBox; edt_search: TEdit; lbl_sort: TLabel; lbl_search: TLabel; ListBox1: TListBox; PrintDialog1: TPrintDialog; rdg_options: TRadioGroup; StringGrid1: TStringGrid; procedure btn_closeClick(Sender: TObject); procedure btn_printClick(Sender: TObject); procedure cmb_searchChange(Sender: TObject); procedure cmb_sortChange(Sender: TObject); procedure edt_searchChange(Sender: TObject); procedure FormCreate(Sender: TObject); procedure FormShow(Sender: TObject); procedure ListBox1Click(Sender: TObject); procedure rdg_optionsClick(Sender: TObject); procedure StringGrid1Selection(Sender: TObject); private { private declarations } public { public declarations } end; var frm_ReportView: Tfrm_ReportView; implementation uses Unit1;

Dharmesh Tailor

156

F454 Computing Project

Software Development & Testing

26. Fill String Grid with Column Headers What to Test Fill String Grid Column Headers

Type of Test Black Box

Test Data Used The Report View form is loaded.

Expected Result

Actual Result

The String Grid is filled with column headers on form create.

The String Grid is filled with column headers on form create.

Expected Result

Actual Result

Test Passed? Yes

Black Box Test:

Column headers filled on form create. 27. Populate Search Combo Box What to Test Populate Search Combo Box

Type of Test Black Box

Test Data Used Click the Search Combo Box

Test Passed? The combo box is The combo box is Yes populated on populated on form create. form create.

Black Box Test:

Search Combo Box populated on form create

Dharmesh Tailor

157

F454 Computing Project

Software Development & Testing

28. Populate Sort Combo Box What to Test Populate Sort Combo Box

Type of Test Black Box

Test Data Expected Result Used Click the Sort The combo box is Combo Box populated on form create.

Actual Result

Test Passed? The combo box is Yes populated on form create.

Black Box Test:

Sort Combo Box populated on form create

Code for on Form Create: procedure Tfrm_ReportView.FormCreate(Sender: TObject); begin //This fills the string grid with the following headings StringGrid1.Cells[0,0]:='Book ID'; StringGrid1.Cells[1,0]:='Title'; StringGrid1.Cells[2,0]:='Author'; StringGrid1.Cells[3,0]:='ISBN'; //This fills the search combobox with the following fields cmb_search.Items.Add('Book ID'); cmb_search.Items.Add('Title'); cmb_search.Items.Add('Author'); cmb_search.Items.Add('ISBN'); //This fills the sort combobox with the following fields cmb_sort.Items.Add('Book ID'); cmb_sort.Items.Add('Title'); cmb_sort.Items.Add('Author'); cmb_sort.Items.Add('ISBN'); end;

Dharmesh Tailor

158

F454 Computing Project

Software Development & Testing

29. Load records into String Grid What to Test Load Records into String Grid

Type of Test Black Box

Test Data Used The ‘All’ option is selected in the Radio Group.

Expected Result

Actual Result

The String Grid is filled with the records saved in the LibraryDatabase.D AT file.

The String Grid is filled with the records saved in the LibraryDatabase. DAT file.

Test Passed? Yes

Black Box Test:

‘All’ option selected in Radio Group.

Dharmesh Tailor

The widths of the columns are auto-sized.

String Grid filled with data stored in LibraryRecords.DAT

159

F454 Computing Project

Software Development & Testing

30. Fill List Box with Rooms

What to Test Fill List Box with Rooms

Type of Test Black Box

Test Data Used

Expected Result

Actual Result

Test Passed?

The ‘Rooms’ option is selected in the Radio Group.

The List Box is filled with the list of rooms saved in the room.TXT file.

The List Box is filled with the list of rooms saved in the room.TXT file.

Yes

Black Box Test:

List Box filled with list of rooms saved in room.TXT file.

Dharmesh Tailor

‘Rooms’ option selected in Radio Group

160

F454 Computing Project

Software Development & Testing

31. Fill List Box with Categories What to Test Fill List Box with Categories

Type of Test Black Box

Test Data Used The ‘Categories’ option is selected in the Radio Group.

Expected Result

Actual Result

The List Box is filled with the list of categories saved in the category.TXT file.

The List Box is filled with the list of categories saved in the category.TXT file.

Test Passed? Yes

Black Box Test:

List Box filled with list of categories saved in category.TXT file.

Dharmesh Tailor

‘Categories’ option selected in Radio Group

161

F454 Computing Project

Software Development & Testing

Code development: The code to fill the String Grid was developed from the algorithm: 15. Fill the String Grid The algorithm has been attached below but can also be found on page 64 in the Algorithms section. 15. Fill the string grid BEGIN Declare integer variable Count String Grid Row Count = Total Number of Records + 1 FOR Count = 1 to Total Number of Records String Grid Cells (0, Count) = Library Records (Count) Book ID String Grid Cells (1, Count) = Library Records (Count) Title String Grid Cells (2, Count) = Library Records (Count) Author String Grid Cells (3, Count) = Library Records (Count) ISBN ENDFOR END

Dharmesh Tailor

162

F454 Computing Project

Software Development & Testing

Code for selecting an option in the Radio Group: procedure Tfrm_ReportView.rdg_optionsClick(Sender: TObject); var Count, nRow : integer; begin ListBox1.Clear; //Clears the list box for nRow := 1 to StringGrid1.RowCount - 1 do begin //Clears every row in the String Grid StringGrid1.Rows[nRow].Clear; end; //Sets the row count of the String Grid to 1 StringGrid1.RowCount := 1; case rdg_options.ItemIndex of 0: //User selects the All option begin ListBox1.Enabled := False; //Disenables the list box //Sets the String Grid row count to the Total Number of Records + 1 StringGrid1.RowCount := TotalNoOfRecords + 1; //Fills the String Grid with the records from the Library Records array for Count := 1 to TotalNoOfRecords do begin StringGrid1.cells[0,Count]:=IntToStr(LibraryRecords[Count].BookID); StringGrid1.cells[1,Count]:=LibraryRecords[Count].Title; StringGrid1.cells[2,Count]:=LibraryRecords[Count].Author; StringGrid1.cells[3,Count]:=LibraryRecords[Count].ISBN; end; //Auto sizes the column widths of the String Grid AutoSizeGrid(StringGrid1); end; 1: //User select the Rooms option begin ListBox1.Enabled := True; //List box is enabled DisplayRoom; //This runs the DisplayRoom procedure for Count := 0 to RoomList.Count - 1 do begin //Adds the rooms from the Room String List to the List box ListBox1.items.add(RoomList[Count]); end; end; 2: //User selects the Categories option begin ListBox1.Enabled := True; //List box is enabled DisplayCategory; //This runs the DisplayCategory procedure for Count := 0 to CategoryList.Count - 1 do begin //Adds the categories from the Category Room List to the List Box ListBox1.items.add(CategoryList[Count]); end; end; end; end;

Dharmesh Tailor

163

F454 Computing Project

Software Development & Testing

Code development: The code to auto-size the String Grid was developed from the algorithm: 16. Auto size string grid The algorithm has been attached below but can also be found on page 64 in the Algorithms section. 16. Auto size string grid BEGIN Declare integer variable Column Width Minimum Declare integer variable Column Width Maximum Declare integer variable C Declare integer variable R Declare integer variable W FOR C = 0 to String Grid Column Count – 1 Column Width Maximum = Column Width Minimum FOR R = 0 to String Grid Row Count – 1 W = String Grid Text Width Cells (C, R) IF W > Column Width Maximum Column Width Maximum = W ENDIF ENDFOR String Grid Column Width (C) = Column Width Maximum + 10 ENDFOR END Code for auto-sizing the widths of the columns in the String Grid: procedure AutoSizeGrid(Grid: TStringGrid); const ColWidthMin = 90; //Sets the minimum column width to 90 var C, R, W, ColWidthMax: Integer; begin for C := 0 to Grid.ColCount - 1 do //Goes through all the columns begin //Sets the maximum column width to the minimum column width ColWidthMax := ColWidthMin; //Goes through all the rows for R := 0 to (Grid.RowCount - 1) do begin //Sets W to the width of each cell W := Grid.Canvas.TextWidth(Grid.Cells[C, R]); //If W exceeds the maximum column width if W > ColWidthMax then begin //Sets the maximum column width to W ColWidthMax := W; end; end; //Sets the width of each column to the maximum column width + 10 Grid.ColWidths[C] := ColWidthMax + 10; end; end;

Dharmesh Tailor

164

F454 Computing Project

Software Development & Testing

32. Load records of particular room into String Grid What to Test Load Records of particular Room into String Grid

Type of Test Black Box

Test Data Used The ‘Rooms’ option is selected in the Radio Group. The room, ‘Dr Tailor’s Room’, is selected in the List Box.

Expected Result The String Grid is filled with the records whose Room field is ‘Dr Tailor’s Room’.

Actual Result The String Grid is filled with the records whose Room field is ‘Dr Tailor’s Room’.

Test Passed? Yes

Black Box Test:

‘Dr Tailor’s Room’ is selected in the list box.

Dharmesh Tailor

String Grid filled with records whose Room field is ‘Dr Tailor’s Room’.

165

F454 Computing Project

Software Development & Testing

33. Load records of particular category into String Grid What to Test Load Records of particular Category into String Grid

Type of Test Black Box

Test Data Used The ‘Categories’ option is selected in the Radio Group. The category, ‘Infectious Diseases’, is selected in the List Box.

Expected Result The String Grid is filled with the records whose Category field is ‘Infectious Diseases’.

Actual Result The String Grid is filled with the records whose Category field is ‘Infectious Diseases’.

Test Passed? Yes

Black Box Test:

‘Infectious Diseases’ is selected in the list box.

Dharmesh Tailor

String Grid filled with records whose Category field is ‘Infectious Diseases’.

166

F454 Computing Project

Software Development & Testing

Code for selecting field in List Box: procedure Tfrm_ReportView.ListBox1Click(Sender: TObject); var Count : integer; i : integer; nRow : integer; begin for nRow := 1 to StringGrid1.RowCount - 1 do begin StringGrid1.Rows[nRow].Clear; //Clears the String Grid end; StringGrid1.RowCount := 1; //Sets the String Grid row count to 1 i := 0; //Variable i is set to 0 //Goes through all the records for Count := 1 to TotalNoOfRecords do begin case rdg_options.ItemIndex of 1: //If the Room option is selected in the Radio Group begin //If the Rooms in the Library Records array match the selected room in the List Box if LibraryRecords[Count].Room = ListBox1.Items[ListBox1.ItemIndex] then begin i := i + 1; //Increments i by 1 //Increments the String Grid row count by 1 StringGrid1.RowCount := i + 1; //Fills the String Grid with records of the corresponding room StringGrid1.cells[0,i]:=IntToStr(LibraryRecords[Count].BookID); StringGrid1.cells[1,i]:=LibraryRecords[Count].Title; StringGrid1.cells[2,i]:=LibraryRecords[Count].Author; StringGrid1.cells[3,i]:=LibraryRecords[Count].ISBN; end; end; 2: //If Category is selected in the Radio Group Begin //If the Categories in the Library Records array match the selected category in the List Box if LibraryRecords[Count].Category = ListBox1.Items[ListBox1.ItemIndex] then begin i := i + 1; //Increments i by 1 //Increments the String Grid row count by 1 StringGrid1.RowCount := i + 1; //Fills the String Grid with records of the corresponding category StringGrid1.cells[0,i]:=IntToStr(LibraryRecords[Count].BookID); StringGrid1.cells[1,i]:=LibraryRecords[Count].Title; StringGrid1.cells[2,i]:=LibraryRecords[Count].Author; StringGrid1.cells[3,i]:=LibraryRecords[Count].ISBN; end; end; end; end; //Auto sizes the column widths of the String Grid AutoSizeGrid(StringGrid1); end;

Dharmesh Tailor

167

F454 Computing Project

Software Development & Testing

34. Load record into Design View Form What to Test Load record into Design View Form

Type of Test Black Box

Test Data Used

Expected Result

The ‘All’ option is selected in the Radio Group. The second record in the String Grid is selected.

The record selected is loaded into the Design View Form.

Actual Result The record selected is loaded into the Design View Form.

Test Passed? Yes

Black Box Test:

Second record selected in the String Grid

Dharmesh Tailor

168

F454 Computing Project

Software Development & Testing

Second record loaded into Design View Form

Code for selecting record in String Grid: procedure Tfrm_ReportView.StringGrid1Selection(Sender: TObject); var i, Count : integer; begin i := StringGrid1.Row; //i set to the current row in String Grid //Goes through all the records for Count := 1 to TotalNoOfRecords do begin //If a match is found between the data in the String Grid and the record in the Library Records array if StringGrid1.cells[0,i] = IntToStr(LibraryRecords[Count].BookID) then begin CurrentRecordNo := Count; //Current Record Number set to Count //The current record is displayed in the Design View Form Display(CurrentRecordNo); end; end; end;

Dharmesh Tailor

169

F454 Computing Project

Software Development & Testing

35. Search Record What to Test Search Record

Type of Test Black Box

Test Data Used

Expected Result

Select the Title field in the Search Combo Box. Enter ‘Ox’ in the Search Textbox.

The record titled ‘Oxford Handbook of Infectious Diseases’ should be highlighted.

Actual Test Result Passed? The record Yes titled ‘Oxford Handbook of Infectious Diseases’ is highlighted.

Black Box Test:

The record titled ‘Oxford Handbook of Infectious Diseases’ is highlighted

Dharmesh Tailor

‘Ox’ entered in the Search Textbox

Title field is selected in the Search Combo Box

170

F454 Computing Project

Software Development & Testing

Code development: The code to search for a record was developed from the algorithm: 18. Perform search on string grid The algorithm has been attached below but can also be found on page 65 in the Algorithms section. 18. Perform search on string grid BEGIN Declare integer variable nRow String Grid Column = Search Combo box Item Index FOR nRow = 1 to String Grid Row Count – 1 IF Search Textbox = String Grid Cells (Search Combo box Item Index, nRow) String Grid Row = nRow ENDIF ENDFOR END Code to search record: procedure Tfrm_ReportView.edt_searchChange(Sender: TObject); var nRow : integer; begin //String Grid column is set to the item index of the Search Combo Box StringGrid1.Col := cmb_search.ItemIndex; //Goes through all the rows in the String Grid for nRow := 1 to StringGrid1.RowCount - 1 do begin //If the data in the Search Textbox matches the data in the String Grid if Pos(edt_search.Text, StringGrid1.Cells[cmb_search.ItemIndex,nRow]) = 1 then begin StringGrid1.Row := nRow; end; end; end;

Dharmesh Tailor

171

F454 Computing Project

Software Development & Testing

36. Sort Record Alphabetically What to Test Sort Records Alphabetic ally

Type of Test Black Box

Test Data Used Select the Author field in the Sort Combo Box.

Expected Result The records should be sorted alphabetically ascending according to the Author field.

Actual Result The records are sorted alphabeticall y ascending according to the Author field.

Test Passed? Yes

Black Box Test: Before alphabetical sort:

The records, by default, are listed in ascending order of Book ID. After alphabetical sort:

The records are sorted in ascending order alphabetically according to the Author field.

Dharmesh Tailor

Author field selected in the Sort Combo Box.

172

F454 Computing Project

Software Development & Testing

37. Sort Records Numerically What to Test Type of Test Sort Records Black Numerically Box

Test Data Used Select the ISBN field in the Sort Combo Box.

Expected Result

Actual Result

The records should be sorted numerically ascending according to the ISBN field.

The records are sorted numerically ascending according to the ISBN field.

Test Passed? Yes

Black Box Test: Before numerical sort:

The records, by default, are listed in ascending order of Book ID After alphabetical sort:

The records are sorted in ascending order according to the ISBN field.

Dharmesh Tailor

ISBN field selected in the Sort Combo Box

173

F454 Computing Project

Software Development & Testing

Code development: The code to perform a bubble sort was developed from the algorithm: 17. Perform a bubble sort The algorithm has been attached below but can also be found on page 65 in the Algorithms section. 17. Perform a bubble sort BEGIN Declare boolean variable Swap Performed Declare integer variable Count Count = Total Number of Records REPEAT Swap Performed = False FOR Record Number = 1 to Count – 1 IF Book ID in Library Records (Record Number) > Book ID in Library Records (Record Number + I) Temporary Record = Library Records (Record Number) Library Records (Record Number) = Library Records (Record Number + 1) Library Records (Record Number + 1) = Temporary Record Swap Performed = True ENDIF ENDFOR DECREMENT Count UNTIL Swap Performed = False OR Count = 1 END The bubble sort algorithm was tested and stepped through using a trace table as shown on page 67. I also created a console application in Pascal to test the bubble sort. The program’s code has been attached on the next page.

Dharmesh Tailor

174

F454 Computing Project

Software Development & Testing

program bubblesort; {$APPTYPE CONSOLE} var Max : integer; Numbers : array[1..20] of integer; SwapPerformed : Boolean; i, Size, Temp : integer; //This inputs numbers into the array procedure InputArray; var Count : integer; begin writeln('How many numbers would you like to sort up to a maximum of 20?'); readln(Max); writeln('Please enter ',Max, ' numbers'); for Count := 1 to Max do begin readln(Numbers[Count]); end; end; //This outputs the result of the bubble sort procedure OutputArray; var Count : integer; begin for Count := 1 to Max do begin write(Numbers[Count], ' '); end; end; //This is the bubble sort developed from the algorithm I wrote begin InputArray; Size := Max; repeat SwapPerformed := False; for i := 1 to Size-1 do begin if Numbers[i] > Numbers[i+1] then begin Temp := Numbers[i]; Numbers[i] := Numbers[i+1]; Numbers[i+1] := Temp; SwapPerformed := True; end; end; dec(Size); until (SwapPerformed = False) or (Size = 1); OutputArray; readln; end.

Dharmesh Tailor

175

F454 Computing Project

Software Development & Testing

Bubble Sort Program: The user specifies how many numbers they would like to sort and inputs them. The program sorts the numbers using the bubble sort algorithm and then outputs them.

I used the same test data that I used when I initially tested the bubble sort algorithm on page 67. The program and the trace table both produced the same result therefore the sort has been successful. Code to Bubble Sort: procedure BubbleSortBookID; var SwapPerformed : Boolean; RecordNumber, N : Integer; Temp : TProject; begin N := TotalNoOfRecords; repeat SwapPerformed := False; for RecordNumber := 1 to N-1 do begin if LibraryRecords[RecordNumber].BookID > LibraryRecords[RecordNumber+1].BookID then begin Temp := LibraryRecords[RecordNumber]; LibraryRecords[RecordNumber] := LibraryRecords[RecordNumber+1]; LibraryRecords[RecordNumber+1] := Temp; SwapPerformed := True; end; end; dec(N); until (SwapPerformed = False) or (N = 1); end;

Dharmesh Tailor

176

F454 Computing Project

Software Development & Testing

procedure BubbleSortTitle; var SwapPerformed : Boolean; RecordNumber, N : Integer; Temp : TProject; begin N := TotalNoOfRecords; repeat SwapPerformed := False; for RecordNumber := 1 to N-1 do begin if LibraryRecords[RecordNumber].Title > LibraryRecords[RecordNumber+1].Title then begin Temp := LibraryRecords[RecordNumber]; LibraryRecords[RecordNumber] := LibraryRecords[RecordNumber+1]; LibraryRecords[RecordNumber+1] := Temp; SwapPerformed := True; end; end; dec(N); until (SwapPerformed = False) or (N = 1); end;

procedure BubbleSortAuthor; var SwapPerformed : Boolean; RecordNumber, N : Integer; Temp : TProject; begin N := TotalNoOfRecords; repeat SwapPerformed := False; for RecordNumber := 1 to N-1 do begin if LibraryRecords[RecordNumber].Author > LibraryRecords[RecordNumber+1].Author then begin Temp := LibraryRecords[RecordNumber]; LibraryRecords[RecordNumber] := LibraryRecords[RecordNumber+1]; LibraryRecords[RecordNumber+1] := Temp; SwapPerformed := True; end; end; dec(N); until (SwapPerformed = False) or (N = 1); end;

Dharmesh Tailor

177

F454 Computing Project

Software Development & Testing

procedure BubbleSortISBN; var SwapPerformed : Boolean; RecordNumber, N : Integer; Temp : TProject; begin N := TotalNoOfRecords; repeat SwapPerformed := False; for RecordNumber := 1 to N-1 do begin if LibraryRecords[RecordNumber].ISBN > LibraryRecords[RecordNumber+1].ISBN then begin Temp := LibraryRecords[RecordNumber]; LibraryRecords[RecordNumber] := LibraryRecords[RecordNumber+1]; LibraryRecords[RecordNumber+1] := Temp; SwapPerformed := True; end; end; dec(N); until (SwapPerformed = False) or (N = 1); end;

Dharmesh Tailor

178

F454 Computing Project

Software Development & Testing

38. Print Report What to Test Type of Test Print Report Black Box

Test Data Used Print Button is pressed.

Expected Result

Actual Result

A report of the records loaded into the String Grid is generated and this is printed. An information message is displayed confirming this.

A report of the records loaded into the String Grid is generated and this is printed. An information message is displayed confirming this.

Test Passed? Yes

Black Box Test:

Print button pressed

Information dialog produced informing the user that the report has been generated and sent to the printer

Report generated by the program:

Title depends on the option selected above. E.g. Room > Dr Dharman’s Room

Dharmesh Tailor

Report generated from the String Grid

179

F454 Computing Project

Software Development & Testing

Code to print String Grid: //Adapted from http://www.swissdelphicenter.ch/en/showcode.php?id=769 procedure PrintGrid(sGrid: TStringGrid; sTitle: String); var X1, X2: Integer; Y1, Y2: Integer; TmpI: Integer; F: Integer; TR: TRect; begin //Inputs the title from the Print Button routine Printer.Title := sTitle; Printer.BeginDoc; Printer.Canvas.Pen.Color := 0; //Sets the font for the report Printer.Canvas.Font.Name := 'Times New Roman'; Printer.Canvas.Font.Size := 15; //Sets the font size of the title //Sets the style of the title Printer.Canvas.Font.Style := [fsBold, fsUnderline]; //Outputs the title on the canvas Printer.Canvas.TextOut(100, 100, Printer.Title); //Goes through all the columns of the String Grid for F := 0 to sGrid.ColCount - 1 do begin X1 := 0; for TmpI := 1 to F do X1 := X1 + 10 * (sGrid.ColWidths[TmpI]); Y1 := 300; X2 := 0; for TmpI := 1 to F+1 do X2 := X2 + 10 * (sGrid.ColWidths[TmpI]); Y2 := 450; TR := Rect(X1, Y1, X2, Y2); //Sets the spacing between columns //Sets the font style of the records Printer.Canvas.Font.Style := [fsBold]; //Sets the font size of the records Printer.Canvas.Font.Size := 12; //Outputs the columns headers to the canvas Printer.Canvas.TextRect(TR, X1 + 50, 350, sGrid.Cells[F, 0]); //Goes through all the rows in the String Grid for TmpI := 1 to sGrid.RowCount - 1 do begin Y1 := 150 * TmpI + 300; //Sets the spacing between columns Y2 := 150 * (TmpI + 1) + 300; TR := Rect(X1, Y1, X2 - 30, Y2); //Outputs the records to the canvas Printer.Canvas.TextRect(TR, X1 + 50, Y1 + 50, sGrid.Cells[F, TmpI]); end; end; Printer.EndDoc; end;

Dharmesh Tailor

180

F454 Computing Project

Software Development & Testing

procedure Tfrm_ReportView.btn_printClick(Sender: TObject); begin //Depends on the option selected in the Option Radio Group case rdg_options.ItemIndex of //Executes the PrintGrid procedure and sets the title of the report 0 : PrintGrid(StringGrid1, 'Hillcrest Surgery Library Books'); 1 : PrintGrid(StringGrid1, ListBox1.Items[ListBox1.ItemIndex]); 2 : PrintGrid(StringGrid1, ListBox1.Items[ListBox1.ItemIndex]); end; //Message dialog informs user that report has been generated and has been sent to the printer MessageDlg('Report generated and sent to printer.',mtInformation, [mbOK], 0); end;

Dharmesh Tailor

181

F454 Computing Project

Software Development & Testing

39. Close Form What to Test

Type of Test

Close Form

Black Box

Test Data Used Close Button is pressed.

Expected Result

Actual Result

Test Passed?

A confirmation dialog box will appear asking the user if they are sure they want to close the form. If ‘Yes’ is selected then the form is closed.

A confirmation dialog box will appear asking the user if they are sure they want to close the form. If ‘Yes’ is selected then the form is closed.

Yes

Black Box Test:

If ‘Yes’ is pressed then the form closes

Close button pressed

Code to close form: procedure Tfrm_ReportView.btn_closeClick(Sender: TObject); begin //Message dialog appears asking user whether they are sure they want to close the form if MessageDlg('Are you sure you want to close the form?',mtConfirmation,[mbYes,mbNo],0) = mrYes then frm_ReportView.Close; //Closes the Report View form end;

Dharmesh Tailor

182

F454 Computing Project

Software Development & Testing

Beta Testing – Report View Form At this point in the development of the system, all the main functions of the Design View form and the Report View form have been coded and thoroughly tested. However, the Main Menu has not been coded yet and this module adds security to the system and provides access to the user guide. Regardless, I have sent the system as it stands to the end user pointing out any features that have not been produced yet. As with the last beta test, my end user will be able to notify me of any interface problems or any unexpected errors that occur. This will his last opportunity to test the system before I submit the final solution. I have attached the letter I received from my end user below.

Dharmesh Tailor

183

F454 Computing Project

Software Development & Testing

The feedback from the beta testing has been very useful. As requested by my end user, I have removed the Help button from the Report View form. As a result, the interface design of the form has changed slightly:

The Help button has been removed. The Print button has now been moved to the bottom right corner of the form. The problem my end user had when searching for a record was one which I had not tested for. When I conducted the test (test 35), I entered the search query with the same letter case as the record.

Search query entered with the same letter case as the title of the record, ‘Ox’.

However if ‘ox’ is entered instead of ‘Ox’ then the record is not found.

When ‘ox’ is entered, the record titled ‘Oxford Handbook of Infectious Diseases’ should be highlighted.

Dharmesh Tailor

184

F454 Computing Project

Software Development & Testing

To solve this problem, I amended the code slightly so that now if the user enters a search query, the system searches for a record beginning with the query regardless of its letter case. begin if Pos(AnsiLowerCase(edt_search.Text), AnsiLowerCase(StringGrid1.Cells[cmb_search.ItemIndex,nRow])) = 1 then begin StringGrid1.Row := nRow; end; end;

The record titled ‘Oxford Handbook of Infectious Diseases’ is highlighted

‘ox’ entered in the Search Textbox

Title field is selected in the Search Combo Box

The second problem my end user came across was that when he selected the records to be sorted by the author field, the records were sorted successfully but by the author’s full name and not the author’s surname. This has already been demonstrated in test 36. To solve this problem, I would have to use string manipulation functions to obtain the surname and the forename separately from the author’s full name. I have written two algorithms below to demonstrate this. Get Forename BEGIN Declare integer variable Pointer Declare integer variable Count Declare string variable AuthorName Declare string variable Forename Pointer = 1 FOR Count = 1 to LENGTH(AuthorName) IF AuthorName(Count) = SPACE Pointer = Count – 1 ENDIF ENDFOR Forename = COPY(AuthorName, 1, Pointer); END

Dharmesh Tailor

185

F454 Computing Project

Software Development & Testing

Get Surname BEGIN Declare integer variable Pointer Declare integer variable Count Declare string variable AuthorName Declare string variable Surname Pointer = 1 FOR Count = LENGTH(AuthorName) downto 1 IF AuthorName(Count) = SPACE Pointer = Count + 1 ENDIF ENDFOR Surname = COPY(AuthorName, Pointer, LENGTH(AuthorName)); END I also created a console application to test the algorithms. The code has been attached below. program GetName; var FullName, Forename, Surname : string; //This procedure obtains the forename from the full name entered procedure GetForename (const Str:string); var p, i : integer; const SPACE = #$20; begin p := 1; //Goes through every character in the string until a space is found for i := 1 to length(Str) do if Str[i] = SPACE then begin p := i - 1; break; end; Forename := Copy(Str, 1, p); end; //This procedure obtains the surname from the full name entered procedure GetSurname (const Str:string); var p: integer; i: Integer; const SPACE = #$20; begin p := 1; //Goes through every character in the string until a space is found for i := length(Str) downto 1 do if Str[i] = SPACE then begin p := i + 1; break; end; Surname := Copy(Str, p, length(Str)); end;

Dharmesh Tailor

186

F454 Computing Project

Software Development & Testing

begin writeln('Please enter your name in the format FIRSTNAME SURNAME'); readln(FullName); GetForename(FullName); GetSurname(FullName); writeln('Foreame: ', Forename); writeln('Surname: ', Surname); readln; end.

Get Name Program: The user inputs his or her name and the program separates the name into forename and surname. It then outputs the two names.

The program has successfully seperated the forename from the surname. I have attached the final code below: In this procedure, the author’s full name is processed and saved to the author string list in the order: SURNAME, FORENAME. procedure GetAuthorName; var Count : integer; NewAuthor : string; begin //Creates a new string list called AuthorList AuthorList := TStringList.Create; //Goes through all of the records for Count := 1 to TotalNoOfRecords do begin //The AuthorName variable takes the string of the author field at the parameter location AuthorName := LibraryRecords[Count].Author; //Runs the GetForename procedure GetForename(AuthorName); //Runs the GetSurname procedure GetSurname(AuthorName); //Concatenates the surname and the forename in that order

Dharmesh Tailor

187

F454 Computing Project

Software Development & Testing

NewAuthor := concat(Surname, ', ', Forename); //Add the new author arrangement to the string list AuthorList.Add(NewAuthor); end; end; procedure GetForename(const Str: string); var p, i: integer; const SPACE = #$20; begin p := 1; //Goes through all of the characters in the string for i := 1 to length(Str) do //When a space is identified, the location of the space is recorded if Str[i] = SPACE then begin //The pointer takes the value of the position of the space minus one p := i - 1; break; end; //The forename is generated as the string between the character position 1 and the character position of the pointer Forename := Copy(Str, 1, p); end; procedure GetSurname(const Str: string); var p, i: integer; const SPACE = #$20; begin p := 1; //Goes through all of the characters in the string for i := length(Str) downto 1 do //When a space is identified, the location of the space is recorded if Str[i] = SPACE then begin //The pointer takes the value of the position of the space minus one p := i + 1; break; end; //The surname is generated as the string between the character position of the pointer and the character position of the last character Surname := Copy(Str, p, length(Str)); end;

The GetAuthorName procedure is executed when the system first loads up. procedure Tfrm_DesignView.FormCreate(Sender: TObject); begin GetAuthorName; end;

Dharmesh Tailor

188

F454 Computing Project

Software Development & Testing

The Author column in the string grid of the Report View form now needs to be filled with the author names but presented as SURNAME, FORENAME. The rows will be populated from the Author string list. procedure Tfrm_ReportView.rdg_optionsClick(Sender: TObject); begin //Populates the Author column with the author names from the string list StringGrid1.cells[2,Count] := AuthorList[Count-1]; end;

The string grid of records can now be sorted using the existing bubble sort method. When the records are sorted by the author field, they are now sorted by surname before forename.

The author column of the string grid now presents the authors in the format: Surname, Firstname.

Dharmesh Tailor

The records are sorted in ascending order according to surname and then by forename.

The author field is selected in the Sort combo box.

189

F454 Computing Project

Software Development & Testing

Section Three: Library Database Main Menu This unit provides a form of security for the system. The user must know the set password in order to access the records and the rest of the system. In addition, the unit provides access to the Help file. The following table has been taken from the test strategy in the Design section, however with each test’s outcome. Each test will be documented in more detail further in the report. Test No. 1

What to Test Enter correct password

Type of Test Black Box

2

Enter incorrect password once

Black Box

3

Incorrect password entered three times

Black Box

4

Load help file

Black Box

5

Close application

Black Box

Dharmesh Tailor

Test Data Used While the password is set to ‘orange’ enter ‘orange’. While the password is set to ‘orange’ enter ‘pear’. While the password is set to ‘orange’ enter ‘pear’. The incorrect password is entered three times.

The Help button is pressed. The Close button is pressed.

Expected Result

Actual Result

The Design View form is displayed.

The Design View form is displayed.

An error message is displayed informing the user that the password is incorrect. An error message is displayed informing the user that the password is incorrect. The number of attempts remaining decrements by 1 every time an incorrect password is entered. The program will terminate after the 3rd unsuccessful attempt. The Help.PDF file is displayed.

An error message is Yes displayed informing the user that the password is incorrect. An error message is Yes displayed informing the user that the password is incorrect. The number of attempts remaining decrements by 1 every time an incorrect password is entered. The program will terminate after the 3rd unsuccessful attempt. The Help.PDF file Yes is displayed.

The application is closed.

The application is closed.

190

Test Passed? Yes

Yes

F454 Computing Project

Software Development & Testing

Unit Declaration of Variables and Procedures unit Unit4; {$mode delphi} interface uses Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs, StdCtrls, Windows; type { Tfrm_MainMenu } Tfrm_MainMenu = class(TForm) btn_Close: TButton; btn_Enter: TButton; btn_Help: TButton; edt_Password: TEdit; lbl_Password: TLabel; procedure btn_CloseClick(Sender: TObject); procedure btn_EnterClick(Sender: TObject); procedure btn_HelpClick(Sender: TObject); procedure FormCloseQuery(Sender: TObject; var CanClose: boolean); private { private declarations } public { public declarations } end; var frm_MainMenu: Tfrm_MainMenu; implementation uses Unit1; const Password = ''; MaxAttempts = 3; var Attempts : integer;

Dharmesh Tailor

191

F454 Computing Project

Software Development & Testing

1. Enter correct password What to Test Enter correct password

Type of Test Black Box

Test Data Used While the password is set to ‘orange’ enter ‘orange’.

Expected Result The Design View form is displayed.

Actual Result The Design View form is displayed.

Test Passed? Yes

Black Box Test:

‘orange’ entered into the Password Textbox Enter button pressed

Design View Form displayed

Dharmesh Tailor

192

F454 Computing Project

Software Development & Testing

2. Enter incorrect password once What to Test Enter incorrect password once

Type of Test Black Box

Test Data Used While the password is set to ‘orange’ enter ‘pear’.

Expected Result

Actual Result

An error message is displayed informing the user that the password is incorrect.

An error message is displayed informing the user that the password is incorrect.

Test Passed? Yes

Black Box Test:

‘pear’ entered into Password Textbox Enter button pressed

Information dialog displayed informing the user that they have entered the wrong password

Dharmesh Tailor

The number of attempts is decremented by 1

193

F454 Computing Project

Software Development & Testing

3. Incorrect password entered 3 times What to Test Incorrect password entered three times

Type of Test Black Box

Test Data Used While the password is set to ‘orange’ enter ‘pear’. The incorrect password is entered three times.

Expected Result

Actual Result

An error message is displayed informing the user that the password is incorrect. The number of attempts remaining decrements by 1 every time an incorrect password is entered. The program will terminate after the 3rd unsuccessful attempt.

An error message is displayed informing the user that the password is incorrect. The number of attempts remaining decrements by 1 every time an incorrect password is entered. The program will terminate after the 3rd unsuccessful attempt.

Test Passed? Yes

Black Box Test:

Incorrect password entered into the Password Textbox three times

Information dialog displayed informing the user that the incorrect password has been entered three times. The application will automatically terminate following this.

Dharmesh Tailor

194

F454 Computing Project

Software Development & Testing

Code for entering password: procedure Tfrm_MainMenu.btn_EnterClick(Sender: TObject); begin inc(Attempts); //Increments the number of attempts by 1 //Compares the string entered into the Password Textbox with the Password if CompareText(edt_password.Text,Password) = 0 then begin frm_DesignView.Show; //Displays the Design View form frm_MainMenu.Visible := False; //Hides the Main Menu end else //If the number of attempts is less than the maximum number of attempts allowed if (Attempts < MaxAttempts) then begin //Displays an information dialog informing the user that the wrong password has been entered and the number of attempts he/she has left Application.MessageBox(PAnsiChar('You have entered the wrong password. You have '+inttostr(3-Attempts)+' attempt(s) left'), 'Incorrect Password', 0); edt_password.Text := ''; //Resets the Password Textbox end else begin //Information dialog informing the user that the wrong password has been entered three times Application.MessageBox('You have entered the wrong password 3 times. Please contact the adminstrator.', 'Incorrect Password', 0); Application.Terminate; //The application is terminated end; end;

Dharmesh Tailor

195

F454 Computing Project

Software Development & Testing

4. Load help file What to Test Load help file

Type of Test Black Box

Test Data Used The Help button is pressed.

Expected Result

Actual Result

The Help.PDF file is displayed.

The Help.PDF file is displayed.

Test Passed? Yes

Black Box Test:

Help button pressed

The User Guide.PDF is opened.

Code to load help file: procedure Tfrm_MainMenu.btn_HelpClick(Sender: TObject); begin Shellexecute(Handle, 'open', 'User Guide.PDF', NIL, NIL, SW_SHOW); end;

This is the same code for loading the help file in the Design View form.

Dharmesh Tailor

196

F454 Computing Project

Software Development & Testing

5. Close application What to Test Close application

Type of Test Black Box

Test Data Used The Close button is pressed.

Expected Result

Actual Result

The application is The application closed. is closed.

Test Passed? Yes

Black Box Test:

Close button pressed

Confirmation dialog asking whether you are sure you want to exit the application.

‘Yes’ is selected and the application closes.

Code to close application: procedure Tfrm_MainMenu.btn_CloseClick(Sender: TObject); begin if MessageDlg('Are you sure you want to exit the application?',mtConfirmation,[mbYes,mbNo],0) = mrYes then Application.Terminate; end;

Dharmesh Tailor

197

F454 Computing Project

Software Development & Testing

Integration Testing The purpose of this section is to show a complete end-to-end testing of the system in its entirety and to ensure that the individual modules link together successfully. The majority of the integration tests were completed during my alpha testing however I conducted a final integration test of the complete program after all the other tests. At no point during the test did the system fail to work. Opening the program:

Loading the user guide (test 4):

Dharmesh Tailor

198

F454 Computing Project

Software Development & Testing

Entering the password and loading the Design View form (test 1):

Dharmesh Tailor

199

F454 Computing Project

Software Development & Testing

Saving a record (test 16):

Saving the file (test 17):

Dharmesh Tailor

200

F454 Computing Project

Software Development & Testing

Deleting a record (test 22):

Dharmesh Tailor

201

F454 Computing Project

Software Development & Testing

Loading the Report View form (test 23):

Loading records into String Grid (test 29):

Populating list box with rooms (test 30):

Dharmesh Tailor

202

F454 Computing Project

Software Development & Testing

Loading record from a particular room (test 32):

Searching for a record (test 35):

Sorting the records (test 36):

Dharmesh Tailor

203

F454 Computing Project

Software Development & Testing

Printing report (test 38):

Closing Report View form (test 39):

Closing the application (test 25):

Dharmesh Tailor

204

F454 Computing Project

Software Development & Testing

Acceptance Testing All the features of the program have been fully implemented and tested. Therefore, I will now send the solution to my end user, as part of the acceptance testing, so that my end user and the other General Practitioners at Hillcrest Surgery can test all of the features. This will ensure that the solution fulfils the specification requirements.

I am pleased with my end user’s response to the acceptance testing of the system. My end user is clearly very happy with the solution to the problem and feels that it fulfils the requirements specification that was agreed during the investigation phase of development. The end user later sent me a letter providing me with a full evaluation of the system, including areas where the system could be improved. This has been included in the evaluation section.

Dharmesh Tailor

205

F454 Computing Project

Documentation

Documentation

Dharmesh Tailor

206

Hillcrest Surgery

337 Uxbridge Road, London, W3 9RA

Installation Guide

Library Database System

Installation Guide 1

Introduction Congratulations on your acquisition of the Library Database System. The purpose of this guide is to instruct you on how to install this system onto your computer. This software must be installed manually from a Memory USB Stick and this guide is here to help you through this process.

Installation Guide 2

Installation 1) Pick up the Memory USB Stick containing the program.

Fig. 1: Memory USB Stick

2) Insert Memory USB Stick into a USB Port.

Fig. 2: Memory USB Stick inserted into the USB Port of the computer

Installation Guide 3

3) Press the ‘Start’ Button.

Fig. 3: The Start Menu

My Documents

My Computer

Start Button

Fig. 4: The Start Button

4) Click on the ‘My Computer’ icon. Fig. 5: The My Computer icon

Installation Guide 4

5) The Memory USB Stick should be listed under ‘Devices with Removable Storage’.

Fig. 6: The Removable Disk icon listed under Devices with Removable Storage

6) Double click on the ‘Removable Disk’ icon.

Fig. 7: The Removable Disk icon

7) Right click the Library Database System folder and select ‘Copy’. Fig. 8: The Library Database System folder

Installation Guide 5

8) Click on the ‘My Documents’ icon. Fig. 9: The My Documents icon

9) Right click in the folder and select ‘Paste’.

Fig. 10: Copying the Library Database System folder to My Documents

10) To run the program, double click the Library Database executable file within the folder.

Fig. 11: Running the Library Database System

Installation Guide 6

Fig. 12: The Library Database System executable file

11) To create a desktop shortcut, right click the Library Database executable file and select ‘Send To’ then select ‘Desktop (Create Shortcut)’.

Fig. 13: Creating a Desktop shortcut

The program is now installed into the My Documents folder. Whenever you want to run the program, double click the shortcut on the desktop. For more information on the actual program, please see the User Guide.

Hillcrest Surgery

337 Uxbridge Road, London, W3 9RA

User Guide

Library Database System

User Guide 1

Introduction This user guide has been designed to ensure that all users of the Library Database System have the knowledge necessary to make the most use of the system. All the common features of the system are covered and are described with screenshots. Any further questions or problems that could arise when using the system are addressed at the end in the Troubleshooting section. For any issues concerning the installation of the system and the running of the system executable, please refer to the Library Database System Installation Guide included within the program folder.

Contents 1 Menu Navigation .......................................................................................................................... 2 1.1 Opening the User Guide ..................................................................................................... 2 1.2 Closing the Application ...................................................................................................... 2 1.3 Entering the Password....................................................................................................... 3 1.4 Opening the Report View form ....................................................................................... 4 1.5 Closing the Report View form ......................................................................................... 5 1.6 Closing the Design View form ......................................................................................... 5 2 Manipulation of records in Design View ............................................................................. 7 2.1 Creating a New Record ...................................................................................................... 7 2.2 Entering Data into a Field ................................................................................................. 8 2.3 Selecting a Room or Category ......................................................................................... 8 2.4 Saving a Record .................................................................................................................... 8 2.5 Editing a Record ................................................................................................................... 9 2.6 Deleting a Record ................................................................................................................. 9 2.7 Saving the File .................................................................................................................... 10 2.8 Navigating between Records ........................................................................................ 10 3 Loading, sorting, searching and printing of records in Report View .................... 11 3.1 Loading Records into Table .......................................................................................... 11 3.2 Loading Records in a Room .......................................................................................... 12 3.3 Loading Records in a Category .................................................................................... 13 3.4 Searching for a Record .................................................................................................... 14 3.5 Sorting the Table ............................................................................................................... 15 3.6 Printing the Report .......................................................................................................... 16 3.7 Loading record into Design View Form ................................................................... 16 4 Backup Procedures ................................................................................................................... 18 5 On-Screen Help .......................................................................................................................... 20 6 Troubleshooting Guide ........................................................................................................... 24

User Guide 2

1 Menu Navigation 1.1 Opening the User Guide

To open the User Guide, press the „Help‟ button located towards the bottom left corner of the Main Menu.

1.2 Closing the Application

Press the „Close‟ button located towards the bottom right corner of the Main Menu to close the application (after confirmation) and return to the Desktop.

User Guide 3

Select the „Yes‟ button to close the application or the „No‟ button to return to the Main Menu.

1.3 Entering the Password

To access the entire system, enter the password supplied by Hillcrest Surgery and select the „Enter‟ button. The Design View form will open following this.

An error is displayed if the password entered is incorrect. The application will close after 3 attempts.

User Guide 4

If the password is entered correctly, the Design View form will open.

1.4 Opening the Report View form

Press the „Report View‟ button located towards the bottom of the Design View form to open the Report View form.

User Guide 5

Report View form opened.

1.5 Closing the Report View form

Press the „Close‟ button located towards the bottom right corner of the Report View form to close the Report View form and return to the Design View form.

1.6 Closing the Design View form

Press the „Close‟ button located towards the bottom right corner of the Design View form to close the application (after confirmation) and return to the desktop.

User Guide 6

Select the „Yes‟ button to close the application or the „No‟ button to return to the Main Menu.

User Guide 7

2 Manipulation of records in Design View See 2.1

See 2.5

See 2.4

See 2.7

See 2.6

See 2.8

See 2.2

See 2.3

See 1.4

See 1.6

2.1 Creating a New Record

To create a new record, select the „New Record‟ button and a new record with blank fields will be created.

User Guide 8

2.2 Entering Data into a Field

To enter data into a field, select the field you wish to type in and type using your keyboard.

2.3 Selecting a Room or Category

To select a room or category, select the arrow on the combo box and click on the desired item in the list. 2.4 Saving a Record

To save a record, select the „Save Record‟ button and an information dialog box should appear.

User Guide 9

This information dialog box confirms that the record has been saved successfully.

2.5 Editing a Record

To edit a record, select the „Edit Record‟ button and all the fields will be enabled.

2.6 Deleting a Record

To delete a record, select the „Delete Record‟ button. You will be required to confirm that you wish to delete the selected record before the delete is performed.

Select the „Yes‟ button to proceed with the delete.

User Guide 10

This information dialog box confirms that the record has been deleted successfully.

2.7 Saving the File

To save the file, click the „Save File‟ button and an information dialog box should appear.

This information dialog box confirms that the file has been saved successfully.

2.8 Navigating between Records

To navigate to the next record, click on the „Up-Arrow‟ or scroll the mouse wheel downwards.

To navigate to the previous record, click on the „Down-Arrow‟ or scroll the mouse wheel upwards. The fields will be refilled with the corresponding record.

User Guide 11

3 Loading, sorting, searching and printing of records in Report View See 3.4 See 3.1 to 3.3

See 3.7 See 3.5 See 3.6

3.1 Loading Records into Table

To load all the records into the table, select the „All‟ option.

The table is filled with all the records saved in the Library file.

User Guide 12

3.2 Loading Records in a Room

To load the records in a particular room, first select the „Room‟ option.

The list box is filled with all the rooms in the practice. Select a room in order to view the records in the selected room.

The table is filled with all the records in the selected room.

User Guide 13

3.3 Loading Records in a Category

To load the records in a particular category, first select the „Category‟ option.

The list box is filled with all the categories. Select a category in order to view the records in the selected category.

The table is filled with all the records in the selected category.

User Guide 14

3.4 Searching for a Record

To search for a record, first select a field in the combo box you wish to search by. Then enter the search query into the text box below.

If found, the requested record is highlighted.

User Guide 15

3.5 Sorting the Table

To sort the table, select a field in the combo box you wish to sort by.

The table will be sorted by the selected field in ascending order.

User Guide 16

3.6 Printing the Report

To print the report, select the „Print‟ button.

The report is sent to the default printer as set by Windows.

3.7 Loading record into Design View Form

To load a record into the Design View form, select a record in the table.

User Guide 17

The fields in the Design View form are refilled with the record selected in the Report View table.

User Guide 18

4 Backup Procedures The system does not have an automatic backup feature therefore all backing up of data must be done manually. 1) Select the files: „LibraryDatabase.DAT‟, „Category.TXT‟ and „Room.TXT‟. Then right click and select „Copy‟.

2) Insert the Kingston Data Traveller 4GB Memory USB Stick. 3) Navigate to „My Computer‟ and double click the „Removable Disk‟ icon.

User Guide 19

4) Double click the folder named „Library Database Backups‟.

5) Create a new folder and enter the date in the format ‘YYYY MM DD’.

6) Right click anywhere within the folder and select „Paste‟.

The files have been successfully backed up.

User Guide 20

5 On-Screen Help In addition to this user guide, the system also makes use of on-screen help to further assist you. The various aspects of on-screen help used within the system are:  The Human Computer Interface (HCI) of the program has been designed to be simple to use and intuitive. A level of consistency has been maintained between all of the forms whereby all of the fields and buttons have been labelled and all of the forms have headers. These features are to ensure smooth navigation throughout the system.  Information dialogues are displayed to alert you if a process has been complete. E.g. “Record Saved.” when a record has been successfully saved. Confirmation dialogues are displayed to ask you for confirmation before carrying out the process. E.g. “Are you sure you wish to delete this record?” when the „Delete‟ button is pressed.  Validation has been implemented whenever you are required to enter and save data. When you enter data, the system will automatically perform a length and type check. If you enter invalid data or exceed the maximum number of characters allowed, the system will output a beep. When saving data, the system will perform a presence check whereby missing fields will be highlighted red and an information dialog box will appear.  A tab order has been assigned to all of the objects on the forms. Pressing the „Tab‟ button on the keyboard will guide you round the objects in a logical order making it easier to navigate within a form.  Hovering your mouse over an object on any of the forms will display an on-screen hint. The hint describes the purpose of the object and what it is used for.

User Guide 21

Examples of the On-Screen help capabilities of the system Information Dialogues:

This is displayed when the Library file has been successfully saved.

This is displayed when the record has been successfully saved.

This is displayed when the record has been successfully deleted. Confirmation Dialogues:

This is displayed when the ‘Delete’ button is pressed.

This is displayed when the ‘Close’ button is pressed.

User Guide 22

Validation:

Missing fields are highlighted red.

This is displayed if the ‘Room’ field is blank.

This is displayed if the ‘Title’ field is blank.

User Guide 23

On-Screen Hints:

User Guide 24

6 Troubleshooting Guide Section 1 Below is a list of the error messages that may appear during use of the system, accompanied by their reasons. Error Message

Reason This is a common error and the likely reason for this includes leaving the „Caps Lock‟ button on or entering a space before inputting the password into the field. As the password is case sensitive, you must enter the exact password otherwise an error message will be produced and you will not be allowed to access the rest of the system. After three attempts, the system will automatically close. These information dialogues are displayed when any one of the Room, Title, Author, Category or ISBN fields have been left empty and the „Save Record‟ button has been pressed. The record will not be saved until these messages have been

User Guide 25

sorted out. Ensure that you have entered data into the missing fields.

This error message is produced when the Library File is empty and the „Delete Record‟ button has been pressed. As there are no records in the file, no records can be deleted. Once all records have been deleted, you can create a new record by selecting the „New Record‟ button followed by selecting the „Save Record‟

User Guide 26

button once data for the record has been entered. This message is produced when you have selected for the application to be closed and you have left records open. To solve this error, either cancel the open record or save it, making sure that data has been entered into the fields. Then select the „Close‟ button and the application should close.

User Guide 27

Section 2 This section deals with any common problems you may come across when using the system. It is presented in a question and answer format. When I delete a record, the corresponding row in the table still remains. You should be able to solve this problem by refilling the table. To refill the table, close the Report View form and reopen it. The record should now be removed from the table. Information I previously entered into the program does not appear to have saved as when I open the program again nothing has been saved. The only possible explanation for this is that before exiting the application, you did not save the records to file by selecting the „Save File‟ button. This button saves any changes to the LibraryDatabase.DAT file which is the file from which the records are read from when the application loads up again. I have entered the correct password but the program will not let me login. See the solution to the „Incorrect Password‟ error message above. On loading the application, I get the error “File not found.” This is because you are missing the LibraryDatabase.DAT file in the system‟s folder. You must reinstall the system and then restart the application.

F454 Computing Project

Evaluation

Evaluation Discussion of the degree of success in meeting the original objectives My end user has confirmed that the solution fulfils the requirements specification. This statement from my end user can be found in the Software Development and Testing section (page 194), in the letter following the acceptance testing of the system. Nevertheless, I will evaluate each objective in the requirements specification to the extent to which they have been met by the solution. In addition, I will provide evidence for my claims by referring to the relevant tests in the Testing section. I have attached below a copy of my requirements specification that was initially agreed with my end user during the investigation and analysis phase of development (page 35). For each objective, I have evaluated the extent to which the objective has been met by the solution. General Requirements

1. The system needs to store the information of at least 400 books in the library database. Test 16 (page 115) demonstrates that the system has the ability to save records and therefore be able to store the information of books in Hillcrest Surgery. In addition, the data size calculations in the Design section (page 61) indicate that size of the Library Database file with 600 records is only 269 kB. This suggests that the system has the capability of storing far more than 400 records were this to become necessary in the future. However, a problem discovered during system testing was the time taken to save this many records to the file. As the Library Database file was overwritten every time the records were saved to file, this led to long waiting periods before the records were saved. Therefore, this objective has been met by the solution but only to some extent. This will be further discussed in the forthcoming sections.

2. The system needs to automatically assign every new book a Book ID.

Test 18 (page 126) demonstrates that when a new record is created, the record is automatically assigned a Book ID. When there are existing records in the database, the Book ID is calculated by incrementing the previous record’s Book ID by 1. If the database is empty then the Book ID of the new record will be set to 1. Therefore, this objective has been met in its entirety by the solution.

3. The system needs to cater for all the different types of books.

Test 13 (page 107) demonstrates that the user is able to specify the type of book for every book record added. A field was created specifically to meet this objective – the Format field. The type of book is added by selecting an entry in the Format combo box. The combo box is populated when the system first loads up. Therefore, this objective has been met by the solution.

Dharmesh Tailor

242

F454 Computing Project

Evaluation

4. The system needs to cater for all the different categories. Test 8 (page 95) demonstrates that the user is able to specify the category for every book record added. A field was created specifically to meet this objective – the Category field. A category is added by selecting an entry in the Category combo box. The Category combo box is populated when the system first loads up. The categories are read from the category.TXT file which contains all the different categories. This means that, if necessary, the existing categories can be edited or removed and new categories can be added. Therefore, this objective has been met successfully by the solution.

5. The system needs to store the location of the books.

Test 7 (page 93) demonstrates that the user is able to specify the room where every book is located. A field was created specifically to meet this objective – the Room field. A room is added by selecting an entry in the Room combo box. The Room combo box is populated when the system first loads up. The rooms are read from the room.TXT file which contains all the different rooms in the practice. This means that, if necessary, the existing rooms can be edited or removed and new rooms can be added. Therefore, this objective has been met successfully by the solution.

6. The system needs to sort books by Book ID, Title, Author and ISBN.

Test 36 and test 37 (pages 172 and 173) demonstrate that the user is able to sort book records by Book ID, Title, Author and ISBN. A different approach to this objective was taken whereby only the String Grid in the Report View form is sorted instead of the array of records. A bubble sort algorithm was used to sort the records both alphabetically and numerically, in ascending order. However, the bubble sort algorithm is a relatively inefficient sorting algorithm and with large number of records, the sorting can take increased periods of time, as I experienced during testing. Therefore, this objective has been met by the solution but only to some extent. This will be further discussed in the forthcoming sections.

7. The system needs to search for books by entering a Book ID, Title, Author or ISBN.

Test 35 (page 170) demonstrates that the user is able to search for books records by entering its Book ID, Title, Author or ISBN. A different approach to this objective was taken whereby the record searched is found in the String Grid in the Report View form. When a search query is entered (either by entering a Book ID, Title, Author or ISBN), the record is located in the String Grid. The record is then highlighted and this loads the record in the Design View Form. Therefore, this objective has been met by the solution.

8. The system needs to output the records to a table onscreen.

Test 29 (page 159) demonstrates that the user is able to view the records in a table onscreen. The String Grid (table) on the Report View form can be filled with records by selecting an option in the Radio Group. The entire array of records can be loaded or the records can be filtered by displaying only the records in a certain room or category. Therefore, this objective has been met successfully by the solution.

Dharmesh Tailor

243

F454 Computing Project

Evaluation

9. The system needs to produce a hard copy report formatted similarly to the report acquired during the observation of the current system. Test 38 (page 179) demonstrates that the system can produce a hard copy report. The report is generated from the table of records in the Report View form. A report can be produced displaying all the records, the records in a specific room or the records in a specific category. The report is given a title based on the option selected, for example if the records in Dr Tailor’s Room are selected then the title would be ‘Dr Tailor’s Room’. The format of the report has been adapted from the sample reports acquired in the Investigation and Analysis section (page 23) with a few modifications. These modifications have been addressed in the Design section (page 58). Therefore, this objective has been met successfully by the solution.

10. The system needs to be secure enough to prevent anyone but the GPs from accessing it. Test 1 (page 192) demonstrates the password dialog form which is displayed before the rest of the system. My end user, Dr Tailor, has decided upon a password and this has been embedded into the system. The user has a maximum of 3 attempts after which the system will automatically close. Therefore, this objective has been met successfully by the solution.

11. The system needs to be intuitive with a simple interface so that it is accessible for end users with limited experience in IT. The system has been designed with simplicity in mind. All of the objects have been evenly spaced out and a similar design has been used throughout all the forms. There is a user guide at hand if users have any difficulty in using certain aspects of the system. On-screen hints are displayed by hovering the mouse over an object. Keyboard short cuts have been integrated within the system, including the use of the Tab button to navigate between the fields and the use of the Enter button to confirm a message dialog. However, there are ways in which the system could have been made more intuitive and easier for the user to use. This will be discussed further in the Desirable Extensions section. In all, this objective has been met by the solution but only to some extent.

Thus, as explained above, all of the objectives in the requirements specification have been met but to varying degrees.

Dharmesh Tailor

244

F454 Computing Project

Evaluation

User’s response to the system

Dharmesh Tailor

245

F454 Computing Project

Evaluation

Evaluation of the user’s response In the letter, my end user, Dr Tailor, expressed that he was very impressed with the system and that he has enjoyed using it. He believes that the system will be worthwhile for the practice and will help the staff greatly in managing their large collection of books. My end user has highlighted several features which he enjoyed using. His favourite feature seems to be the sorting feature, which organises the records in the string grid by fields such as Title, and the searching feature which allows for book records to be found much more quickly than in the previous system. Although it wasn’t a specific feature, my end user also commended the validation. The validation prevents the end user from entering any invalid data into the fields.

However, my end user did have one issue with the system. The problem is that although the system has the capacity to store more than 100 records, the saving time can be quite long. The problem arises because the Library Database file, where the records are saved, is overwritten every time the records are saved. This problem was detected during the testing of the system and has been evaluated above in the discussion of the first objective in the requirements specification. The problem can be temporarily fixed by manually creating a new file to store the records once the total number of records in any one file exceeds 100. This would require the end user to move the existing Library Database file to another location and creating a new file with the same file name. A better solution would be to further develop the system so that it automatically creates a new database file when the total number of records exceeds 100. An another problem would then arise as more than one record would have the same Book ID and this defeats the purpose of the Book ID as an unique identifier. A solution to this would be to replace the format in which the records are saved. Such a solution will be further discussed in the Desirable Extensions section.

My end user also suggested a possible extension to the current system. The extension would take the form of a loaning feature which would therefore allow all members of staff to borrow books. This feature would require much more coding and possibly even several more forms. This feature would ideally be implemented in due time but given the scope of the project and the time given to complete it, it was simply not feasible to complete it. This may indicate that perhaps my end user was not completely satisfied with the solution as there are still features which could be added to it to make it better. This extension will be further discussed in the Desirable Extensions section. Overall, I believe that my end user is satisfied with the solution and the way it has turned out. Although there are ways in which the system could have been improved, the limited set of objectives in the requirements specification has nevertheless been met.

Dharmesh Tailor

246

F454 Computing Project

Evaluation

Strengths of the system 1. The system is computerised – This is an obvious strength that was agreed upon in the Definition section of the report. This means that the processing and the output of data is performed automatically by the system rather than manually as was the case in the previous system. 2. The input objectives have been fulfilled – This means that all the required data is taken in by the system. 3. The output objectives have been fulfilled – This means that the desired output is produced by the system in the form of an onscreen report and a hard copy output.

4. The processing objectives have been fulfilled – The Book ID of a new record is generated correctly, book records are sorted by different fields and book records can be searched for. 5. Password protection – The system is protected from unwanted access by a password dialog feature that only gives the user a limited number of attempts. 6. Comprehensive user guide provided – The user guide can be accessed when using the system, it provides help with using certain features. 7. System is robust – All of the fields are validated to ensure that only valid data is entered into the fields.

Weaknesses and limitations of the system

1. The system crashes when saving more than 100 records - This is a limitation of the system and possible solutions have already been discussed.

2. The system only runs on computers with a Windows OS – This is a limitation of the system as if the practice were to upgrade their computers, the system would not be compatible.

3. Back-ups have to be done manually by the end user – This is a weakness of the system as the data is extremely valuable to the practice and any loss of data can be frustrating. A solution to this problem would be an automatic back-up feature. This will be discussed in more detail below. 4. The report is not very customisable - This is a limitation of the system as the hardcopy output cannot be edited before it is printed out. In addition, the report cannot be sent electronically (e.g. via email).

5. The ISBN field is not completely validated – Although a length and presence check is performed on this field, there is no validation check to ensure that a valid ISBN has been entered.

Dharmesh Tailor

247

F454 Computing Project

Evaluation

Extensions As previously stated, I am pleased with the way the solution has turned out and I am satisfied that it has met all of the objectives in the requirements specification as set out by my end user and I. The system has some commendable features such as the ability to sort records by different fields, load records by category and room and its password protection. The system, like every database system, has the basic functions to create, save and delete records. However, as pointed out by my end user and I, there are a few areas in which the system could be extended to further enhance the functionality of the system. 1. As pointed out during the evaluation of the requirements specification, there are ways in which the system could have been extended to make it more intuitive to use. A greater number of tooltips and more onscreen help would have made the system easier to use. To view the user guide, the user would select the Help button and this would open the user guide as a PDF file. However, this is reliant upon the Adobe Reader software and if the software on the computers in Hillcrest Surgery changed in the future then the end user would be unable to view the user guide. The system could be extended to integrate the user documentation within the system. This would be implemented through the use of the TIpHTMLPanel component within the Lazarus IDE thus allowing the documentation to be viewed as a separate form within the system.

2. During the investigation of the current system, it was discovered that the desktop computer, where the system was eventually installed on, had a resolution of 1024 x 768 pixels. The system, therefore, has been designed specifically for this resolution. Any resolution greater or less than this resolution is not supported by the system. If the computers were to be upgraded in the future, then the system would not be supported. A possible extension of the system could be a feature capable of changing the resolution of the program. This could be implemented by creating a separate form providing the user with a list of the common resolutions so that the user can select a resolution matching the set resolution of their machine.

3. A major problem in the system is that as the total number of records increases, the time taken to save the records to the Library Database file also increases. The reason for this has already been explained in detail above. Short-term solutions have already been discussed however to properly sort out the problem, a more long-term solution would be required. The fault lies in the inefficiency of the .DAT file format. An extension would be to save the records as a CSV (Comma Separated Values) file. Saving to a CSV file is more reliable and much faster than saving to a DAT file. Unlike the DAT file format, the CSV file format stores the data in a more logical way by separating each value with a delimiter. In addition, the library records would be loaded much more quickly into the system and it would allow greater manipulation of the records using external software such as Microsoft Excel. This extension would be implemented by using a parsing algorithm to analyse the CSV file for delimiters and read the individual data items into the array. 4. My end user suggested a loaning book feature as a possible extension to the system. The extension would allow all members of staff to borrow books from the practice. To implement the feature, I would be required to create a new User Table which would store the details of all the staff in Hillcrest Surgery. A new form would need to be created to manage the user details. I would then have to link the Book and User Tables together by using their unique identifiers; this would allow staff to loan books. Several more form would need to be created to loan the books. New fields would need to be created such as

Dharmesh Tailor

248

F454 Computing Project

Evaluation

Date In and Date Out to further increase the system’s functionality. As all the staff have their own NHS cards with unique identifiers, the cards could be used within the system through the use of a card reader. The cards would be used to give instant access to the system. There are many possibilities with this extension and additional hardware would be required.

Dharmesh Tailor

249

View more...

Comments

Copyright ©2017 KUPDF Inc.
SUPPORT KUPDF