h dip hoffman_r_final

30
Software Engineering, System Design 1 Cover Page Library System (Lib SYS) Robert Hoffman Higher Diploma in Computing Submitted on the 06/12/2011

Upload: robertjameshoffman

Post on 25-Dec-2014

1.613 views

Category:

Technology


2 download

DESCRIPTION

 

TRANSCRIPT

Page 1: H dip hoffman_r_final

Software Engineering, System Design

1

Cover Page

Library System (Lib SYS)

Robert Hoffman

Higher Diploma in Computing

Submitted on the 06/12/2011

Page 2: H dip hoffman_r_final

Software Engineering, System Design

2

Table of Contents

1. Introduction/Overview .................................................................................................................... 3

2. Hierarchy Chart ............................................................................................................................... 4

3. User Requirements .......................................................................................................................... 5

4. System Requirements ...................................................................................................................... 6

5. Dataflow Diagrams ....................................................................................................................... 11

6. Database Schema .......................................................................................................................... 17

7. Program Specification ................................................................................................................... 18

8. Conclusion/Summary .................................................................................................................... 30

Page 3: H dip hoffman_r_final

Software Engineering, System Design

3

1. Introduction/Overview

The project which I’ve done for software engineering is a library system. When doing this project I had to first start out by doing a hierarchy chart this shows the structure and the

hierarchy of the software modules. In a diagram what you want the program to do. Next I did the user requirements and system requirements. The user requirements are statements of the system requirements for the customer and end user of the system. In the System requirements I provided a more detailed description of the functionality. In the dataflow diagram section I provided DFD to show how data flows are used through a sequence of processing steps I also outlined class diagrams with their relationships. In the database schema section I provided details for the attributes which would be used when implementing the system. Finally in the program specification section I put in a screen layout for three program specification. I outlined a main menu, adding a new member and MIS function (listing the history of the book). In the conclusion section I outlined a few of the system requirements which I could of also put in.

Page 4: H dip hoffman_r_final

Software Engineering, System Design

4

2. Hierarchy Chart

Page 5: H dip hoffman_r_final

Software Engineering, System Design

5

3. User Requirements

The functional user requirements for the proposed system (LibSYS) are described below:

3.1 LibSYS will perform all aspects of book administration.

3.1. 1 LibSYS will allow for new books to be added to the system.

3.1. 2 LibSYS will allow book changes to be made.

3.1. 3 LibSYS will allow for books to be removed.

3.1. 4 LibSYS will allow book enquiries to be performed

3.1. 5 LibSYS will list what books have been taken out by members

3.2 LibSYS must perform all aspects of member administration

3.2.1 LibSYS will allow member details to be recorded in the system.

3.2.2 LibSYS will allow removal of member details.

3.2.3 LibSYS will allow changes to be made to member details.

3.3 LibSYS must support the loan functions.

3.3.1 LibSYS will allow member loans to be recorded.

3.3.2 LibSYS will allow for book returns to be recorded.

3.3.3 LibSYS will list the overdue books.

Page 6: H dip hoffman_r_final

Software Engineering, System Design

6

4. System Requirements

The system requirements for the user requirements described above in section 3 are presented in

this section.

4.1 Manage Books

4.1.1 Add new book

When a book is added to the library, this needs to be reflected in the system.

Each book is identified by a unique identifier (Book_ID). This identifier is assigned by the system. The

book status is assigned a default status of ‘A’ (available).The book title and authors name must be

input by the system user. The register date is assigned the system date. The input data is validated

and any errors are reported to the user.

The user can cancel the transaction at any time.

If all input is valid, the unique identifier and the valid input data are then recorded in the book file

with a default status ‘added’. A confirmation message is then displayed on the user interface.

4.1.2 Change Book

It might be necessary to change a book registered details (for example, change of book details). The

registered details for the book are first retrieved from the book file. This data may be retrieved using

the unique identifier (book_ID) or by using the book title. If the book details are retrieved by book

title, there may be more than one book title retrieved. In this case, the user selects the required

book. The retrieved details are displayed for amendment by the system user. Changes are not

allowed if the book is removed (i.e. status ‘R’)

If the user proceeds with the change, the amended data is validated and any errors are reported to

the user. When all inputs are valid, the amended data is written in the book file. A confirmation

message is then displayed on the user interface.

Next, the input fields are cleared and the system user may amend another book details

4.1.3 Remove book

When a book is removed from the library, this needs to be reflected in the system.

The registered details for the book are retrieved from the book file. This data may be retrieved using

the unique identifier (Book_ID) or by using the book title and author name. The retrieved details are

displayed on the user interface, but may not be amended.

The book may not be removed if it is currently out on loan.

Page 7: H dip hoffman_r_final

Software Engineering, System Design

7

If the user proceeds with the removal, a status of ‘R’ (removed) is recorded in the book file for the

book in question.

Next, the input fields are cleared and the system user may remove another book from the library.

Next, the unique identifier (Book_ID) is incremented by one, the input fields are cleared and the

system user may add another book.

4.1.4 Book Enquiry

A member enquires to see if the book the member wants is in the library. The book details are

retrieved from the book file. The book data may be retrieved using the unique identifier (Book_ID)

or by using the book title.

The retrieved details are displayed on the user interface. The details should show if the book is in the

library or if the book is “U” (unavailable).

4.1.5 Book History

Every time a book is borrowed by a member, a record of the loan is recorded in the system. This

allows a history for a particular book to be produced.

The book details of all books are retrieved from the book file. The retrieved details are displayed on

the user interface. The user selects the book for which the history is required.

By using the Book_ID for the selected book, all loan details for this book are retrieved from the loan

file and the loan items file and the details of the member who borrowed the book are retrieved from

the member file.

The information is displayed on the user interface.

The user has the option to print if required.

4.2 Manage Members

4.2.1 Register Member

When a new member joins the library, the member details must be recorded in the system. Each

member is identified by a unique identifier (Member_ID). This identifier is assigned by the system.

Name, address and contact details must be input by the system user. The register date is assigned

the system date. The input data is validated and any errors are reported to the user.

The user may cancel the transaction at any time.

Page 8: H dip hoffman_r_final

Software Engineering, System Design

8

If all the input data is valid, the unique identifier and the valid input data are then recorded in the

members file with a default status of ‘active’. A confirmation message is then displayed on the user

interface.

Next the unique identifier (Member_ID) is incremented by one, the input fields are cleared and the

system user may register another member.

4.2.2 Change Member

It might be necessary to change a member’s registered details (for example, change of address or

telephone number). The registered details for the member are first retrieved from the member file.

This data may be retrieved using the unique identifier (Member_ID) or by using surname. If the

member details are retrieved by surname, there may be more than one member retrieved. In this

case, the user selects the required member. The retrieved details are displayed for amendment by

the system user.

Amendments are not allowed if the member’s status is ‘removed’.

If the user proceeds with the change, the amended data is validated and any errors are reported to

the user. When all inputs are valid, the amended data is written in the Members file. A

confirmation message is then displayed on the user interface.

Next, the input fields are cleared and the system user may amend another members details.

4.2.3 Remove Member

When a member is removed from the library, this needs to be reflected in the system.

The registered details for the member are retrieved from the member file. This data may be

retrieved using the unique identifier (Member_ID) or by using the surname. The retrieved details are

displayed on the user interface, but may not be amended.

The member may not be removed if there is books currently out on loan.

If the user proceeds with the removal, a status of “removed” is recorded in the member file for the

member in question.

Next, the input fields are cleared and the system user may remove another member from the library

4.3 Manage loans

4.3.1 Book loan

When a book loan is taken out in the library, the loan details must be recorded in the system. Each

book loan is identified by a unique identifier (Loan_ID). This identifier is assigned by the system. The

details for the member are retrieved from the member file. This data may be retrieved using the

unique identifier (Member_ID) or by using the surname.

Up to four books can be borrowed in a single loan. The registered details for each book (up to

four books) are retrieved from the book file and are displayed. This data may be retrieved using the

Page 9: H dip hoffman_r_final

Software Engineering, System Design

9

unique identifier (Book_ID) or by using the book title and author name. There is also a maximum

limit of 4 books per member per loan.

The loan date is set to the current system date. The date on which the books are due to be returned is determined by the system. This date is set to the date two weeks after the loan date. The Loan_ID, Member_ID, loan date and due date are recorded in the Loan file. The return date for each book will be NULL until the book is actually returned. Each book may be returned late, in which case a fine will be applied. This fine amount will be set to zero, until such time as the book is actually returned. For each book borrowed (up to four books), the Loan_ID, Book_ID, Return Date (NULL) and Fine amount (zero) are written to the Loan Items file.

The status for each book borrowed is set to “U” (unavailable) in the book file. The user may cancel the transaction at any time.

If all the input data is valid, the unique identifier and the valid input data are then recorded in the

loan file.

A confirmation message is then displayed on the user interface.

Next the unique identifier (Loan_ID) is incremented by one, the input fields are cleared and the

system user may register another book loan.

4.3.2 Return Book

When a book is returned to the library, this needs to be reflected in the system.

The registered details for the loan are retrieved from the loan file. This data may be retrieved using

the unique identifier (Loan_ID) or by using the title of the book. This data may be retrieved using the

unique identifier (Member_ID) or by using the surname. The details for the member are retrieved

from the member file. This data may be retrieved using the unique identifier (Member_ID) or by

using the surname.

The retrieved details are displayed on the user interface, but may not be amended. The date the

book is returned must be recorded in the loan items file. The input data is validated and any errors

are reported to the user.

The date the book is returned must be recorded in the loan item file. A book may be returned late, in which case a fine will be applied. This fine amount will be set to zero, until such time as the book is actually returned. For each book returned (up to four books), the Loan_ID, Book_ID , Return Date (is recorded) and Fine amount (is applied if necessary) are recorded in the Loan Items file.

If the book is late, (i.e. the return date is greater than due date) a fine is stored in the Fine amount in

the loan items file. There is a €1.00 fine per day.

If the user proceeds with the removal, a status of “returned” is recorded in the book file for the

book in question.

Page 10: H dip hoffman_r_final

Software Engineering, System Design

10

Next, the input fields are cleared and the system user may return another book to the library

4.3.3 List Overdue books

A list of the overdue books may be required.

The loan details of the overdue books are retrieved from the loan file and loan items file. These

details are displayed on the user interface. The member details and book titles are retrieved from

the member file and book file. This data may be retrieved using the unique identifier (Loan_ID).

When a book is late, (i.e. the return date is greater than due date) a fine is stored in the loan item

file. Loans which have not been returned (i.e. return date is null) and for which due date less than

today’s date a fine is applied to the member.

For each overdue book a fine is occurred. There is a €1.00 fine per day. The system calculates the

total amount of fine the member has to pay. The system does this by comparing when the book was

supposed to be returned to today’s date and adding a €1.00 for each day that the book was due.

The system should show the list of overdue books by members with print option.

Page 11: H dip hoffman_r_final

Software Engineering, System Design

11

5. Dataflow Diagrams

Level-0 DFD

Loan request

Loan

Library

System

Member

Page 12: H dip hoffman_r_final

Software Engineering, System Design

12

Level-1 DFD

Member details

Book details

Member details Member details

Member Details

Book details

Loan details

P1

Record

Book

D1 Book File

P2

Manage

Loan D2 Loan File

D3 Member File

P3

Manage

Member

Member

D4 Loan Item file

Page 13: H dip hoffman_r_final

Software Engineering, System Design

13

Level-2 DFD Process P1

Book details

Book details

Book details

Book details

Book details

Loan details

Loan details

P1.1

Add Book

D1 Book file

P1.2

Remove Book

P1.3

Change Book

P1.4

Book Enquiry

P1.5

Book History

D2 Loan file

D4 Loan Items file

Page 14: H dip hoffman_r_final

Software Engineering, System Design

14

Level-2 DFD Process P2

Member Details

Book details

Loan details Loan details

Loan Details

` Member details Book details Member Details

Loan details member details Loan Details

Member details Member details

Loan details Loan Details

Loan Details

Book Details

Loan details

P2.1

Loan Book

D2 Loan file

Member

D3 Member file

P2.2

Return Book

D2 Book file

P2.3

List Overdue

Books

D4 Loan Item file

D4 Loan Item file

D2 Loan file

D3 Member file

Page 15: H dip hoffman_r_final

Software Engineering, System Design

15

Level-2 DFD Process P2

P3.1

Register member

D3 Member File

P3.2

Change member

P3.3

Remove

member

Member

Member details

Member details

Member details

Member ID

Member details

Member details

Page 16: H dip hoffman_r_final

Software Engineering, System Design

16

Class Diagram

1..1 can have 0..*

1..1

Has a

1..*

1..1 can have 0..*

Member

Member_ID {PK}

Surname

Forename

Street

Town

County

Phone no

Status

Loan

Loan_ID {PK}

Due date

Loan date

Book

Book_ID {PK}

Book title

Author

Status

Loan Item

Return Date

Fine amount

Page 17: H dip hoffman_r_final

Software Engineering, System Design

17

6. Database Schema

Schema: LibSYS

Relation: Books

Attributes:

BookId number(6)

Title char(30) NOT NULL

Author char(30) NOT NULL

Status char(1) DEFAULT „A‟

Primary Key BookId

Relation: Members

Attributes:

MemberId number(4)

Surname char(20) NOT NULL

Forename char(20) NOT NULL

Street char(25) NOT NULL

Town char(25) NOT NULL

County char(15) NOT NULL

Phone no number(15)

Primary Key MemberId

Relation: Loans

Attributes:

LoanId number(6)

MemberId number(4) NOT NULL

LoanDate NOT NULL

DateDue date NOT NULL

Primary Key LoanId

Foreign Key MemberId REFERENCES Members

Relation: Loan Item

Attributes:

LoanId number(6)

BookId number(6) NOT NULL

DateReturned date

FineAmt number(4, 2)

Primary Key LoanId , BookId

Foreign Key BookId REFERENCES Books

Foreign Key LoanId REFERENCES Loans

Page 18: H dip hoffman_r_final

Software Engineering, System Design

18

7. Program Specification

Program Specification

System : LibSYS Author: R Hoffman

Module : Main Menu Date: 17/11/2011

Invoked By:

None

Invokes:

Book Menu

Member menu

Loan Menu

Inputs:

None

Outputs:

None

Screen Layout:

Page 19: H dip hoffman_r_final

Software Engineering, System Design

19

Error Messages: None

Process:

BEGIN

DO UNTIL EXIT

IF BOOK MENU

Pass control to Book Module

ELSE IF MEMBER MENU

Pass control to Member Module

ELSE IF LOAN MENU

Pass control to Loan Module

END DO

IF EXIT

Terminate Program

END

Page 20: H dip hoffman_r_final

Software Engineering, System Design

20

Program Specification System : LibSYS Author: Robert Hoffman

Module : Add Member Date: 21/11/2011

Invoked By:

LibSYS Invokes:

None

Inputs: Surname

Forename

Street

Town

County

Phone no

Outputs:

New Member Record

Screen Layout:

Error Messages:

1. Surname must be entered

2. Forename must be entered

3. Street must be entered

Page 21: H dip hoffman_r_final

Software Engineering, System Design

21

4. Town must be entered

5. County must be entered

6. Phone no must be Numeric

Process:

BEGIN

Do GetNextMemberID

Display System Date

Display form

Do Until EXIT or BACK

IF INSERT

If Surname is blank then

Do Display Error Message

Exit

ELSE IF Forename is blank then

Do Display Error Message

Exit

ELSE IF Street is blank then

Do Display Error Message

Exit

ELSE IF Town is blank then

Do Display Error Message

Exit

ELSE IF County is blank then

Do Display Error Message

Exit

ELSE IF Phone No is blank then

Do Display Error Message

Exit

End If

Open Database

` Set status = „A‟

Write Member record

Close Database

Do Clear Screen

END IF

End Do

Page 22: H dip hoffman_r_final

Software Engineering, System Design

22

IF EXIT

Terminate program

IF BACK

Return to Main Menu

END

Display Error Message(X)

Begin

IF X = 1 then

Display “Surname Must be Entered”

ELSE IF X = 2 then

Display “Forename Must be Entered”

ELSE IF X = 3 then

Display “Street Must be Entered”

ELSE IF X = 4 then

Display “Town Must be Entered”

ELSE IF X = 5 then

Display “County Must be Entered”

ELSE IF X = 6 then

Display “Phone No Must be Entered”

END IF

END

Clear Screen () Begin

DO GetNextMemberId

Surname = “” Forename = “”

Street = “”

Town = “”

County = “”

Phone no = “”

END

Page 23: H dip hoffman_r_final

Software Engineering, System Design

23

GetNextMemberId

Begin

Connect to database

Retrieve last MemberID assigned from Member File

IF Last MemberID is NULL

SET MemberID = 1

ELSE

SET MemberID = Last MemberId +1

Close Database

END

Page 24: H dip hoffman_r_final

Software Engineering, System Design

24

Program Specification

System : LibSYS Author: Robert Hoffman

Module : Edit Member Date: 21/11/2011

Invoked By:

LibSYS

Invokes:

None

Inputs: Member ID

Outputs:

Edit Member Record

Screen Layout:

Error Messages:

1. Member ID must be Numeric

Process:

BEGIN

Display form

Do Until EXIT or BACK

Page 25: H dip hoffman_r_final

Software Engineering, System Design

25

Insert MemberId

Retrieve the details for the member in the member file

Display form

If status = “R”

Do Display Error Message (1)

Exit

IF EDIT

If Surname is blank then

Do Display Error Message (2)

Exit

ELSE IF Forename is blank then

Do Display Error Message (3)

Exit

ELSE IF Street is blank then

Do Display Error Message (4)

Exit

ELSE IF Town is blank then

Do Display Error Message (5)

Exit

ELSE IF County is blank then

Do Display Error Message (6)

Exit

ELSE IF Phone No is blank then

Do Display Error Message (7)

Exit

End If

Open Database

Write Member record

Close Database

Do Clear Screen

END IF

End Do

IF EXIT

Terminate program

IF BACK

Return to Main Menu

Page 26: H dip hoffman_r_final

Software Engineering, System Design

26

END

Display Error Message(X)

Begin

IF X = 1 then

Display “Amendments are not allowed”

ELSE IF X = 2 then

Display “Surname Must be Entered”

ELSE IF X = 3 then

Display “Forename Must be Entered”

ELSE IF X = 4 then

Display “Street Must be Entered”

ELSE IF X = 5 then

Display “Town Must be Entered”

ELSE IF X = 6 then

Display “County Must be Entered”

ELSE IF X = 7 then

Display “Phone No Must be Entered”

END IF

END

Clear Screen () Begin

DO GetNextMemberId

Surname = “” Forename = “”

Street = “”

Town = “”

County = “”

Phone No = “”

END

Begin

Connect to database

Page 27: H dip hoffman_r_final

Software Engineering, System Design

27

Retrieve last MemberID assigned

IF Last MemberID is NULL

SET MemberID = 1

ELSE

SET MemberID = Last MemberId +1

Close Database

END

Page 28: H dip hoffman_r_final

Software Engineering, System Design

28

Program Specification

System : LibSYS Author: Robert Hoffman

Module : List Overdue books Date: 21/11/2011

Invoked By:

LibSYS

Invokes:

None

Inputs:

Outputs:

List overdue books

Screen Layout:

Error Messages:

Process:

BEGIN

Retrieve details of all loans where due date is less than today from loan file and loan items

file.

Retrieve corresponding member and book details from member file and book file.

Page 29: H dip hoffman_r_final

Software Engineering, System Design

29

Load retrieved details into form control in order of due date.

Display Form

IF EXIT

Terminate program

IF BACK

Return to Main Menu

IF PRINT

Format overdue data into print format.

Send to printer

Display Confirmation message

END

Page 30: H dip hoffman_r_final

Software Engineering, System Design

30

8. Conclusion/Summary

In this project I left out a few things that I could have put in the system requirements. These

were that I could have put in the date the book was added and the date the book was

destroyed in the book file. Also I would of put in the date the member was added and the date

the member was removed in the member file. I could also have put in a library card with a

Card_No and date allocated which would have been in a new file called LibraryCard the

Card_no would have been the primary key and also Member_Id{Fk} would be in the

LibraryCard file. I would also put in an Author file with the attributes of author_no {pk} and

author name. I could also have put in a book title file with the attributes of isbn_no {pk},

book title and category. I could also have put in an Authorship file with the attributes of

isbn_no {pk, fk} and author_no {pk, fk}. Finally given more time I would of put the attribute

of Member type {adult, child, student, OAP} in the members file. I would‟ve of put in a

member type file with the attributes Member type and description.