Anda di halaman 1dari 15

CSC 7322 : Object Oriented Development

J Paul Gibson, A207

paul.gibson@int-edu.eu

http://www-public.it-sudparis.eu/~gibson/Teaching/CSC7322/

OO Analysis & Design Case Study


http://www-public.it-sudparis.eu/~gibson/Teaching/CSC7322/L9-OOAD-CaseStudy.pdf

2010: J Paul Gibson T&MSP: Software Engineering CSC7322/OOAD-CaseStudy.1


Objectives

Analyse a natural language description of a problem to be


solved using software, and clearly identify the boundaries of
the system to be built

Construct a UML description of the requirements, and in


doing so resolve issues such as ambiguity,
inconsistency/incoherence, incompleteness and
over/underspecification.

Add details to the UML in order to generate a (correct)


design that can be used by Java programmers to implement
the software solution

2010: J Paul Gibson T&MSP: Software Engineering CSC7322/OOAD-CaseStudy.2


Case Study: A library

Overview and Context

We wish to develop a system to help with the management of a library


catalogue and the users.

The library contains books, CDs and DVDs.

The catalog is accessible to all clients; but only the library employees
can make changes to the catalogue record: by adding/removing
documents and clients; and changing the status of documents and clients.

The system is being developed to modernize the current catalogue which


is stored on written cards, and which is becoming too slow as the number
of library documents is growing every year. Further, the current catalogue
cannot be accessed by the clients and is only open to the library staff.

2010: J Paul Gibson T&MSP: Software Engineering CSC7322/OOAD-CaseStudy.3


Case Study: A library

Problem Expression

The library contains documents which are either internal or external. An


internal document cannot be borrowed, but an external document can be
borrowed (for a limited period of time)

Clients can be added and removed from the library (by library staff). Each
client has a name, address and unique identification number.

Clients can be subscribed or unsubscribed. A subscribed client can


borrow up to 10 documents. An unsubscribed client can borrow up to 3
documents.

2010: J Paul Gibson T&MSP: Software Engineering CSC7322/OOAD-CaseStudy.4


Case Study: A library

Problem Expression …

Documents are CDs, DVDs and books. There are CDs that are also a
special kind of audio book. Every document has a location in the library
(which notes the physical location of where it must be stored while not
being used), and a unique identifier. There may be multiple copies of the
same document in the library. No client can borrow more than 1 copy of
the same document at any one time. Every document has the following
information: title, author, year.

Books also have publisher information, a genre (crime, SF, etc) and the
number of pages.

CDs also have information regarding the type of music (rock, pop etc)

For DVDs we also record the length of the film and the age
restriction/classification

2010: J Paul Gibson T&MSP: Software Engineering CSC7322/OOAD-CaseStudy.5


Case Study: A library
Problem Expression …

When a document is borrowed, a card is created on which is noted the


client, the document and the date for return. Books can be borrowed for 2
weeks, CDs for a week and DVDs for 2 days.

If a client has an overdue document then they are refused permission to


borrow any further documents.

At the beginning of each day, the list of overdue books is updated. Clients
who return all borrowed documents that are overdue can immediately
borrow another document (without waiting for the next day).

A subscribed client who has more than 5 overdue books in total loses
their subscription and automatically becomes unsubscribed.

Only a library official can change the type/status of a client from


unsubscribed to subscribed.
2010: J Paul Gibson T&MSP: Software Engineering CSC7322/OOAD-CaseStudy.6
Case Study: A library

Problem Expression …

The current state of the library can be read by all users:

For each type of document (book, cd, dvd) we can see the
current number of borrowing instances

For each document we can see the current borrowers

For each user we can see the current documents borrowed

2010: J Paul Gibson T&MSP: Software Engineering CSC7322/OOAD-CaseStudy.7


Case Study: A library

Problem Expression …

Long-term Statistics are available to all users of the library:

For each type of document (book, cd, dvd) we can see the
total number of borrowing instances

For each document we can see the total number of borrowing


instances

For each user we can see the total number of documents


borrowed

2010: J Paul Gibson T&MSP: Software Engineering CSC7322/OOAD-CaseStudy.8


Case Study: A library

Problem Analysis

Step 1

Find the actors and the system functions available to the


actors.

Using this information, draw the use-case diagram

2010: J Paul Gibson T&MSP: Software Engineering CSC7322/OOAD-CaseStudy.9


Case Study: A library

Problem Analysis

Step 2

Identify the classes in the system

For each class identify the attributes/operations

Identify the relationships between classes

Using this information draw a class diagram

Verify that the system « functions » - so that there is a flow


of execution in the class diagram for each of the use-cases.

2010: J Paul Gibson T&MSP: Software Engineering CSC7322/OOAD-CaseStudy.10


Case Study: A library

Problem Analysis and Design

Step 3

For the document class (I hope you have one!):

analyse the different states that a document can be in, and


specify an invariant property

Identify the ways in which the state of a document can


change, and draw the corresponding state machine diagram

2010: J Paul Gibson T&MSP: Software Engineering CSC7322/OOAD-CaseStudy.11


Case Study: A library

Problem Analysis and Design

Step 4

For the client class (I hope you have one!):

analyse the different states that a client can be in, and specify
an invariant property

Identify the ways in which the state of a client can change,


and draw the corresponding state machine diagram

2010: J Paul Gibson T&MSP: Software Engineering CSC7322/OOAD-CaseStudy.12


Case Study: A library

Problem Analysis and Design

Step 5

For the operation borrow (I hope you have one) draw a


communication diagram that shows the interactions that
occur between a client, a document and a borrow card.

Represent the same information in a sequence diagram

2010: J Paul Gibson T&MSP: Software Engineering CSC7322/OOAD-CaseStudy.13


Case Study: A library

Problem Analysis and Design

Step 6

For the operation return (I hope you have one) draw a


communication diagram that shows the interactions that
occur between a client, a document and a borrow card.

Represent the same information in a sequence diagram

2010: J Paul Gibson T&MSP: Software Engineering CSC7322/OOAD-CaseStudy.14


Case Study: A library

Problem Analysis and Design - Review

You now have a partial description of the system to be


developed (and problem to be solved)

What other diagrams do you need to draw in order to have a


more complete design model?

Can you now suggest changes in order to improve the


original English description --- think about problems you had
when trying to transform the text into UML

Are you ready to turn the design into Java code? Is it at a


good level of abstraction?

2010: J Paul Gibson T&MSP: Software Engineering CSC7322/OOAD-CaseStudy.15

Anda mungkin juga menyukai