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...
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?
1 Answer
This is an interesting example:
- The
Bookrefers 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
BookItemrefers 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
BookItemsmay refer to the sameBook, 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.