Library Management System-Software Engineering-Lecture 17 Slides-Computer Science, Slides of Software Engineering

The course is intended to develop an understanding of the problems associated with the development of significant computing systems (that is, systems that are too large to be designed and developed by a single person, and are designed to be used by many users) and to appreciate the techniques and tools necessary to develop such systems efficiently, in a cost-effective manner. Library Management System, Types, State Space, Database, Operations, Returning a Book, Adding Books, Removing Books, Inte

Typology: Slides

2011/2012

Uploaded on 02/03/2012

gustavott
gustavott 🇬🇧

3.9

(14)

253 documents

1 / 23

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
LECTURE 17: LIBRARY CASE STUDY
Software Engineering
Mike Wooldridge
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17

Partial preview of the text

Download Library Management System-Software Engineering-Lecture 17 Slides-Computer Science and more Slides Software Engineering in PDF only on Docsity!

LECTURE 17: LIBRARY CASE STUDY

Software Engineering

1 A Library Management System

  • In this lecture, we specify a simple library system.
  • Operations: - check out a book; - return a book; - add a book to library; - remove book from library; - get list of books by author or subject area; - get list of books checked out by particular borrower;

1.1 Types

  • We need sets for: - all possible books; - all possible copies of books; - all possible people; - all possible authors; - all possible subjects; - the various reports that may be produced.
  • So parachute in:

[BOOK, COPY, PERSON, AUTHOR, SUBJECT, REPORT]

1.2 State Space

  • The state space is describes in several steps. First, a schema containing information relating to books in the library.

ParaLibrary instance of : COPY → 7 BOOK written by : BOOK → 7 IP AUTHOR about : BOOK → 7 IP SUBJECT dom written by ⊆ ran instance of dom about ⊆ ran instance of

  • The database part of the schema is as follows:

LibraryDB borrower, staff : IP PERSON available, out : IP COPY borrowed by : COPY → 7 PERSON borrower ∩ staff = ∅ available ∩ out = ∅ dom borrowed by = out ran borrowed by ⊆ borrower ∀p : borrower • #borrowed by∼(|{p}|) ≤ MaxCopies

  • borrower is the set of all borrowers known to the system;
  • staff is the set of all staff known to the system;
  • available is the set of all available books;
  • out is the set of borrowed books (i.e., ones that have been checked out);
  • borrowed by tells us who borrowed the books out on loan.
  • The library state space is then as follows:

Library ParaLibrary LibraryDB dom instance of = available ∪ out

  • the only invariant in this schema tells us that the library does not know anything about books which are not in stock.

1.3 The Operations

  • We assume initialisation operations; these are trivial.
  • First we look at checking out books...
  • Inputs: person name (n?) and copy (c?).

CheckOut ∆Library n? : PERSON c? : COPY n? ∈ borrower c? ∈ available #borrowed by∼(|{n?}|) < MaxCopies available′^ = available \ {c?} out′^ = out ∪ {c?} borrowed by′^ = borrowed by∪ {c? 7 → n?}

1.4 Returning a Book

  • One input: the copy to be returned.

Return ∆Library c? : COPY c? ∈ out available′^ = available ∪ {c?} out′^ = out \ {c?} borrowed by = {c?} − borrowed by

  • precondition states that the book can only be returned if it is out;
  • 1st post-condition says that the book is available after the operation;
  • 2nd post-condition says that the book is no longer out;
  • 3rd post-condition uses domain subtraction to remove the correct record from the borrowed by function.
  • For example,

borrowed by = {b 01 7 → mjw, b 02 7 → en, b 03 7 → mjw} {b 01 } − borrowed by = {b 02 7 → en, b 03 7 → mjw}

AddNewBook ∆Library c? : COPY b? : BOOK a? : IP AUTHOR s? : IP SUBJECT

b? 6 ∈ ran instance of c? 6 ∈ available ∪ out

available′^ = available ∪ {c?} instance of ′^ = instance of ∪ {c? 7 → b?} written by′^ = written by ∪ {b? 7 → a?} about′^ = about ∪ {b? 7 → s?}

AddAnotherCopy ∆Library c? : COPY b? : BOOK

c? 6 ∈ available ∪ out b? ∈ ran instance of

available′^ = available ∪ {c?} instance of ′^ = instance of ∪ {c? 7 → b?}

RemoveOther ∆Library c? : COPY c? ∈ available #(instance of ∼(|{instance of (c?)}|)) > 1 available′^ = available \ {c?}

  • Note that there is no need to alter any variables in ParaLibrary; we only change available, to indicate that the book is no longer available.

RemoveLast ∆Library c? : COPY

c? ∈ available #(instance of ∼(|{instance of (c?)}|)) = 1

available′^ = available \ {c?} instance of ′^ = {c?} − instance of written by′^ = {instance of (c?)}− instance of about′^ = {instance of (c?)} − about