Class Diagram Used to show the static structure of a system. It depicts the classes and their relationships. The – items below should be clear except perhaps the the relationship which we consider later. dependency We can show a class in various degrees of detail as shown below, depending on the stage of modeling. Association & Role Name The association above means that a has-a and that the class has the following instance variable: Person Dog Person Dog pet; Object Diagram An object diagram shows instances of classes at run-time. – Navigability & Multiplicity The diagram on the right shows that a can have 0 to 5 (multiplicity) and the navigability shows Person Dogs that a holds references to the In other words, a knows who his are. On the other Person Dogs. Person Dogs hand, since no navigability is shown on the left side of the association, a does not know who his owner Dog (Person) is. In other words, if you have a object you cannot obtain a reference to the it is associated Dog Person with. Multiplicity values: Examples of multiplicity are shown on the right. Navigability if no navigability is shown (the top relationship in figure on the right) then there is –Technically, two-way navigability: a knows his and a knows his owner (Person). I prefer to use the explicit Person Dogs Dog specification of two-way navigability as shown in the bottom relationship.
Class Diagram – Used to show the static structure of a system. It depicts the classes and their relationships. The items below should be clear except perhaps the the dependency relationship which we consider later. We can show a class in various degrees of detail as shown below, depending on the stage of modeling. Association & Role Name The association above means that a Person has-a Dog and that the Person class has the following instance variable: Dog pet; Object Diagram – An object diagram shows instances of classes at run-time. Navigability & Multiplicity The diagram on the right shows that a Person can have 0 to 5 Dogs (multiplicity) and the navigability shows that a Person holds references to the Dogs. In other words, a Person knows who his Dogs are. On the other hand, since no navigability is shown on the left side of the association, a Dog does not know who his owner (Person) is. In other words, if you have a Dog object you cannot obtain a reference to the Person it is associated with. Multiplicity values: Examples of multiplicity are shown on the right. Navigability –Technically, if no navigability is shown (the top relationship in figure on the right) then there is two-way navigability: a Person knows his Dogs and a Dog knows his owner (Person). I prefer to use the explicit specification of two-way navigability as shown in the bottom relationship.