Classes for Class Diagram Uml

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:

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 Answer

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.
7

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

David Miller

David Miller

Executive Financial & Market Analyst

David Miller brings 15 years of experience in global economics, personal finance strategy, and market dynamics. He specializes in turning complex economic trends into actionable insights for everyday readers.

Share this article
Twitter Facebook Pinterest