Joaquin Miller (email@example.com)
Wed, 19 Jan 2000 09:25:31 -0600
Robert France wrote: >A rule I use (and I would like feedback on the problems) is that a high-level design Class Diagram should show only persistent associations (i.e., associations whose links persist between operation invocation); thus if an object is passed as a parameter to an operation in another object I would not show this relationship as an association in the Class Diagram. Class Diagrams at lower levels of abstraction may show transient relationships as associations/dependencies. Given the specification of the UML, i feel this is the best practice (when using UML as specified). >Of course there are always exceptions to the rule, but if one wants to model a transient relationship as an association in a high-level design Class Diagram there should be a good reason for doing this. One good reason is when using class diagrams to present, for example, patterns. Then it is important to show the connections that will be used by the pattern, whether transient or not. There are two philosophical or stylistic issues underlying this discussion. i. much (most) of what is done in practice is class-oriented, not object oriented. when we base our practice in object interaction diagrams instead of class diagrams, some of these problems melt away. ii. often (very often) in practice two concepts are conflated: relations and references. this practice is codified in UML: the UML association is specified to be a relation; UML links are specified to be instances of UML association; yet, UML links are specified to be used to represent both tuples of relations and references. when from the very start and throughout we distinguish relations (sets of tuples) from sets of references, the question of this thread melts away. ..... Robert, have you ever taught, or considered teaching, that class diagrams are simply a kind of object oriented ERD and that the associations have exactly the meaning of the lines in a classic ERD, and then teaching object interaction diagrams as, not a so called, quote "instance" unquote of a class diagram, but and independent concept, where the links have the several meanings? On the other hand, have you considered teaching heresy: that the associations of a class diagram can have several meanings? That the lines may represent: -- a conceptual relationship between the classes (ERD) -- a conceptual relationship between objects of the classes -- a relation (OMT/UML) -- a slot for a reference (in objects of one or both classes) -- a potential transient reference (from objects of one class to objects of the other) -- ... (yes, the first two may be the same. is there actually no difference? are we clear on that? do we clearly explain that? if so, why do we start with classes, instead of objects?) ================ Gonzalo Genova wrote: >... Or should we understand ... [that] an object OB1 of class CL1 could send a message to any object OB2 of class CL2 whenever an association AS12 exists between classes CL1 and CL2... Good programmers on the shop floor will explain to us, if we ask, that it is dead wrong to consider lines on class diagrams to mean mutual knowledge. Bidirectional references mean rigidity, brittle classes, and low reusability.