0% found this document useful (0 votes)
18 views6 pages

Case Study - 1

The document discusses UML class diagrams and relationships between classes like Orange, Basket, and Barrel. It then provides an example case study about modeling catalogs, books, CDs, DVDs, and magazines as classes with various attributes and methods.

Uploaded by

ngocbich2474786
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views6 pages

Case Study - 1

The document discusses UML class diagrams and relationships between classes like Orange, Basket, and Barrel. It then provides an example case study about modeling catalogs, books, CDs, DVDs, and magazines as classes with various attributes and methods.

Uploaded by

ngocbich2474786
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

Case study:

Remind what is UML diagram


UML:
● Acronym for Unified Modeling Language
○ What: The diagram below describe relationships between each class we have
■ For example: Orange have a association with Basket, and vice versa;
Same goes for Apple and Barrel
○ Why:
■ Very intuitively, easy to imagine
○ How:

● The diagram above only shows "there is an association between each class", it doesn't show
how many oranges can go into 1 basket; or how many baskets can go into 1 orange.

● However, we can specify this by quickly add additional information such as 1:n or 1:1
● go in: "A" can in to "B"; and many "A" (represents by *) can
○ In regrex * - means "0 or more instances of the preceding regex token"
This is additional attributes or properties … etc, (obviously), however, to represent the "1:n"
relationship above, Basket and Barrel need one more attribute of which the functionality is to keep
track of how many and what oranges it stored and vice versa,
Case study:

Catalogs contain lists of books. People search them to find books on certain subjects, with specific
titles, or by a particular author.

● Books can be uniquely identified by an International Standard Book Number (ISBN).


● Each book has a Dewey Decimal System (DDS) number assigned to help find it on a
particular shelf.
● Book as the most important object, with several attributes already mentioned,
○ author;
○ title;
○ subject;
○ ISBN;
○ DDS;

One option is to add attributes to each of our LibraryItem subclasses:

● That hold the information we need, such as Author on Book, Artist on CD (optional);
● Make the relationship to those properties all point to the Contributor class.
Your exercises will be using inheritance, access specifiers (private , protected and public) in python
to design these class with the following attributes and method

Requirements: have docstring in every class and every methods of that class

Catalog:

search → public

LibraryItem:

Locate → public

Title, UPC, Subject, Contributors → public attributes

ContributorWithType:

Contributor → public

Type → protected

Book:

ISBN, Title, Subject, DDS number → public

CD:

Artists → public

DVD:

Genre, Actors, Directors …→ public


Magazine:

Volume, Issue , Editors

You might also like