class diagrams Flashcards
class name should be singular / plural?
singular
attributes should be private or public ?
private (unless qn specifically says otherwise)
methods should be private or public ?
public
what methods to implement? (in class diagram)
for all attributes (values):
- getters & setters for all
- if attributes X specifically required to be added by qn, usually dn, should be calc__ instead)
for all attributes (data structures):
- add, remove, find for all
when computation involved, add method instead of attribute
PSSS find out purpose of class such that the main purpose must be a method inside the superclass.
(eg payment application. calculatePayment() MUST be in super class)
how should the link between parent and child class look like on the diagram?
arrow (hollow triangle pointing upwards)
how should subclass be implemented?
classes with different purposes (eg. read&write) should be split into two diff subclasses
(subclass can have 0 attributes/methods)