Class Diagrams Flashcards
how is a class shown on a class diagram and what does a good class consist of?
a rectangle with a name it shows the classes in a system, attributes and operations of each class and the relationship between each class.
how to avoid conflicts when choosing class names
use a data dictonary
what is Data driven design
identify all data in classes and divide it into classes. Then assign methods to these classes.
what is responsiblity driven design
idenfify all the reponsibilites(methods) of the systems and divde them into classes.
classes correspound to nouns so associations correspone to?
verbs
what is an association
a way of expressing a relationship between classes. There are instances of association.
What are instances of associations called in UML
links
if class A and B are associated then?
some object of class A has to know about some object of class B.
Give examples of multiplicities
1 is just 1
- .10… a range of numbers between 1 and 10
* - arbitary unspecified number (1..*).. this is 1 to an unknown number
what do attributes of a class describe
data contained in an object of the class and their type
what do the operations in a class define
the ways in which objects may interact.
what is an operation signature
gives the selector, names, types of all formal parameters and return type.
what is generalization
if class A is a generalization of class B then the interface of class B must conform to the interface of class A
does generalization increase the coupling of a system?
yes
difference between generalization and inheritance
generalization is a conceptual relationship whereas inheritance is an implementation relationship
What is CRC and what is it good for
Classes, Responsibilities and Collaborations and is used for checking good design. Not part of UML.
What does a CRC consist of
Name of class on top responsiblities of class on the left collaborators on the right
Too many responsibilities in a CRC means what?
low cohesion (bad level abstraction)
what does too many collaborators mean in a CRC?
high coupling (class is connected to too many other classes).
What is the compromise between coupling and cohesion
high cohesion and low coupling