System Development Methods
CT00046-3-2
Class Diagram
Tutorial
Tutorial
Draw a class diagram showing the relationship for the library system
below:
• Students, librarians, and managers are the users in the online library management
system. Data about the user include name, email, phone number, and address. For
the student record, their school needs to be recorded (e.g. School of Computing,
School of Media & Arts, etc.). Some librarians may have overtime works and are to
be paid on an hourly basis thus an hourly charge needs to be recorded in the
database for the payroll purpose. Whilst only the manager has a travel allowance
that will be used to attend international conferences.
• The librarian maintains a book record that includes book code, title, author name,
year, field (e.g. technology, accounting, etc.), and status (i.e. available, reserved, not
available, and lost).
• The student can borrow up to five books at a time, whilst the book might be
borrowed by many students in different periods. When the student borrows the
book, the borrow date and return date need to be recorded.
• It might happen that the student lost the book they borrowed, for this case they can
make a report of the loss of the book. Once it has been officially reported as lost,
then the manager will evaluate and impose a fine on the student’s report. The fine
amount and fine status (i.e. unpaid and paid) will need to be recorded.
CT046-3-2 – SYSTEM DEVELOPMENT METHODS Slide 2
Class Diagram
Class diagram describes the structure of a system by
showing the system's classes, their attributes, operations
(or methods), and the relationships among objects.
A UML class diagram is made up of:
A set of classes and
A set of relationships between classes
CT046-3-2 – SYSTEM DEVELOPMENT METHODS Slide 3
Class Diagram Relationships
• Inheritance (or Generalization):
– Represents an "is-a" relationship.
• Simple Association:
– A structural link between two peer classes.
CT046-3-2 – SYSTEM DEVELOPMENT METHODS Slide 4
Class Diagram Relationships
• Aggregation:
– A special type of association. It represents a "part of" relationship.
• Composition:
– A special type of aggregation where parts are destroyed when the
whole is destroyed.
CT046-3-2 – SYSTEM DEVELOPMENT METHODS Slide 5
Class Diagram Relationships
• Dependency:
– Exists between two classes if the changes to the definition of one
may cause changes to the other (but not the other way around).
• Interface Realization
– Represents the implementation of the functionality defined in one
class by another class.
CT046-3-2 – SYSTEM DEVELOPMENT METHODS Slide 6