Tut 10 - Class and Object Diagrams
Problems
01. Interpret a Class Diagram
To solve this problem, I think the best way is to get the corresponding code, which should be as follows,
Attribute Multiplicity: A plain attribute (e.g.,
- name: String) implicitly has a multiplicity of1(compulsory).Navigability (Arrow
->): An arrow fromAtoBmeans "A knows about B." In code, this means ClassAhas an attribute of typeB.Line Origin (Visuals): It does not matter where an association line starts (from the class name, attribute, or method compartment). It always represents an attribute for the entire class.
02. Draw an object diagram
Step 1: There are no persons.
No person, draw nothing LOL.
Step 2:Alfred is the Guardian of Bruce.

Pay attention to the
Addressclass which has a compulsory multiplicity.
Step 3: Bruce's contact number is the same as Alfred's.

In the object diagram, the "arrow" of the association solid line follows the navigability arrow from the class diagram.
Step 4: Alfred is also the guardian of another person. That person lists Alfred's home address as his home address as well as office address.

Step 5: Alfred has an office address at the Wayne Industries building which is different from his home address (i.e., Bat Cave).

03. Draw a Class Diagram

The attribute's name will be the role name of that attribute.
Fixed sized array, like
new Items[10]here means thepartsattribute has the multiplicity of 10.
Tips
Attribute Multiplicity: A plain attribute (e.g.,
- name: String) implicitly has a multiplicity of1(compulsory).Navigability (Arrow
->): An arrow fromAtoBmeans "A knows about B." In code, this means ClassAhas an attribute of typeB.Line Origin (Visuals): It does not matter where an association line starts (from the class name, attribute, or method compartment). It always represents an attribute for the entire class.
Pay attention to the class which has a compulsory multiplicity.
In the object diagram, the "arrow" of the association solid line follows the navigability arrow from the class diagram.
The attribute's name will be the role name of that attribute.
Fixed sized array, like
new Items[10]here means thepartsattribute has the multiplicity of 10.
Last updated