Class Diagrams Flashcards
purpose of a class diagram
describe the static structure of a system in a visual form
do class diagrams show the fucntional requirements of a system
no
use case models do this
do class diagrams show how classes interact at run time
no
interaction diagrams used for this
3 parts of a class symbol in order
- class name
- attributes
- operations
what does it mean if an object is persistant
stored, once the program is done, there is still a record of this object
what does it mean if an object is transistory
only in existence while the program is running
what is an attribute of a class
a property that describes a range of values that theobjects of that class may hold
how would you show an attribute’s visibility in the class diagram
+ public
- private
eg + attributeName
how would you show an attribute’s type in the class diagram
:
eg. attributeName: int
how would you show an attribute’s multiplicity in the class diagram
[0…1]
eg attributeName [0..1]: String
how would you show an attribute that has an initial value in the class diagram
=
eg attributeName : int = 5
what are derived attributes
attributes who’s value is a result of a computation based on other attribute values
how to represent derived attributes in class diagrams
/aatributeName
where are operations (methods) of a class listed
just below attributes
how to show association between two classes
draw a line and add association name
how to show cardinality in associations
- n means one or more
0. n means 0 or more
what is generalisation in class diagrams equivalent to in java
inheritence
example of generalisation
student in main class undergrad and post grad are sub classes
what is aggregation
when one class is made up of those of another but both can exist in their own right also
what is composition
when one class is made of of another but it cannot exist in it’s own right