3

I am currently studying an example from an online course to design a class diagram for a Library Management System.

However, I am confused with this example: enter image description here

I can't really understand the purpose of creating two classes: Book and Book Item. Couldn‘t I just insert attributes from Book Item class into the Book class and keep only a single class of the two?

2
  • 1
    The Extends label is futile. It's only there to suit Java coders but UML-wise it is here of no use. Commented May 31, 2022 at 21:22
  • 2
    Also the UC diagram in the link you used is just wrong in some aspects. Arrows for extend/include are wrong. Login is no use case. Placing System as actor outside the boundary is - no words... Commented May 31, 2022 at 21:28

1 Answer 1

4

This is an interesting example:

  • The Book refers to an book in the catalogue of the publisher or the library. It has an ISBN to uniquely identify it, a title, an author and so on.
  • The BookItem refers to a copy of that book that is owned by the the library and is lend to the users.

But this example requires improvements:

  • the model should prefer composition over inheritance., which in UML translates tonprefering a simple association over a specialization. Several BookItems may refer to the same Book, and the model does not capture this reality.
  • The boundaries between book and book items need to be reviewed. For example the BookFormat (only in item) may in reality influence the number of pages (in book). Moreover a publishing date seems not to be specific to a book item but general to the book. Printing date could change on each item.
Sign up to request clarification or add additional context in comments.

10 Comments

They even made Book an abstract class, which it clearly shouldn't be. The fact that this is an example from an actual UML course is just sad.
@GeertBellekens Indeed, this is poor course material. On the other side, nobody can claim for a refund, since its free ;-)
Currently reading the OO book from Meyer (the Eiffel guy). He explains in long and broad what inheritance should mean. I just remember where he picked one of the many bad examples: ApplePie inheriting from Apple and Pie (argh!) and Plane inherinting from VentilationSystem. As for the latter: if the crew welcomes me with "Welcome aboard our ventilation systen" I would probably run.
That's a tough one. I once approached it via the ICONIX methodology which really got me going. I came along with a (affordable) example and video explanation (by Dough Rosenberg). That's almost 20 years ago. The "bible" UML 2.5 spec is unfortunately not for a bed lecture. Google fort uml-diagrams.org which have a quite nice overview and examples. A few of it outdated but it's not the worst (at least better than the site you cited). The book from Meyer is quite expensive and does not use current UML notation. Unless you will learn Eiffel or are in compiler construction I would not recommend it.
@qrttttt Martin Fowler‘s book UML distilled is still a very good introduction to most aspects of UML. It has plenty of rather relevant examples. There is the UML user guide as well. It‘s more in depth but it‘s a lot more thicker. It has the advantage of being written by the UML inventors and to uniquely describe the intent behind more advanced and kess understood modelling techniques.
|

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.