class diagrams Flashcards

1
Q

class name should be singular / plural?

A

singular

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

attributes should be private or public ?

A

private (unless qn specifically says otherwise)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

methods should be private or public ?

A

public

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

what methods to implement? (in class diagram)

A

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 well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

how should the link between parent and child class look like on the diagram?

A

arrow (hollow triangle pointing upwards)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

how should subclass be implemented?

A

classes with different purposes (eg. read&write) should be split into two diff subclasses

(subclass can have 0 attributes/methods)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly