i’m reading a uml book (uml demystified) and thought it was all making sense but now i come to try and actually use it, i now realise not so.
class diagrams. i know what a class and an instance of a class is basically about in oop (mainly from objective-c). in uml most class diagrams have mainly classes in. i know that shouldn’t be surprising given the name of these diagrams, class diagrams, but given what i know about oop the preponderance of classes and the absence of instances in the diagrams seems odd to me.
a typical v. simple uml class diagram:
+-------------+ +-------------+
| A | | B |
+-------------+ +-------------+
| | --------> | |
+-------------+ 1 1 +-------------+
| | | |
+-------------+ +-------------+
what is that actually saying?:
- the class (and i mean the class, not an instance of) A has a variable/pointer to the class B?
- an instance of class A has a pointer to an instance of class B?
it must mean classes not instances because there is a way of representing instances, so if it had meant an instance of A should have a pointer to an instance of B it’d have used the instance symbol (a box split horizontally in two by a line rather than split into three). but classes are one off, and have global scope… and hang on though, come to think of it, there are diagrams like this:
+-------------+ +-------------+
| A | | B |
+-------------+ +-------------+
| | --------> | |
+-------------+ 1 1…* +-------------+
| | | |
+-------------+ +-------------+
meaning one A, and one or more B’s. so it must mean instances? you can’t have more than one class of the same type – classes are one offs right?, and instances obviously aren’t. so if it does mean instances why are they using class symbols and what are the instance symbols for?
confused the book doesn’t seem to tackle what i’m asking about at all. not very good.
thanks.