简体   繁体   中英

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM