UML: Class Diagrams

6 flashcards · Computer Science · by lakesare

  1. - name: String [1] = "Untitled" {readOnly} Explain this syntax.

    visibility name: type multiplicity = default {property-string} visibility marker indicates whether the attribute is public (+) or private (-) name of the attribute—how the class refers to the attribute—roughly corresponds to the name of a field in a programming language. type of the attribute indicates a restriction on what kind of object may be placed in the attribute. multiplicity default value is the value for a newly created object if the attribute isn't specified during creation. {property…

  2. Name 2 visibilities in UML.

    + Public - Private # Protected ~ Package

  3. What is the difference between showing property via attribute VS via association?

    Most of the same information appears in both notations, some items are different. In particular, associations can show multiplicities at both ends of the line. Attributes Associations An association is a solid line between two classes, directed from the source class to the target class. The name of the property goes at the target end of the association, together with its multiplicity. The target end of the association links to the class that is the type of the property.

  4. Explain most common multiplicities: 1 0..1 * The multiplicity of a property is an indication of how many objects may fill the property.

    1 - exactly one 0..1 - zero or one * - zero or more

  5. How would you show Person - Car bidirectional association?

    The Car class has property owner:Person[1] The Person class has a property cars:Car[*]. (Note how I named the cars property in the plural form of the property's type, a common but non-normative convention.) A bidirectional association is a pair of properties that are linked together as inverses.

  6. What does the dashed line VS dashed line with an arrow mean?

    dashed line - notes :-) dashed line WITH ARROW - dependency, exists between two elements if changes to the definition of one element (the supplier) may cause changes to the other (the client). Trying to show all the dependencies in a class diagram is an exercise in futility; there are too many and they change too much. Be selective and show dependencies only when they are directly relevant to the particular topic that you want to communicate.