I have the requirement of generating UML Diagrams for one of my C++ assignments. I'm using Visio 2007 and I'm having trouble representing C++ vectors. The only way I can see this working is creating a custom C++ datatype or creating a vector class in my project, then for each instance of a vector in the UML, I need to dig into the properties and add <Class>
into the suffix field.
Basically I'm trying to get vector<Object>
without digging into the properties and adding <Class>
to the suffix field every time.
I'm pretty much stuck with Microsoft software for making diagrams and coding so please don't suggest I use different software. However, if Visual Studio 2003 supports making UML Diagrams in a less painful way than Visio, I wouldn't object to using Visual Studio but please tell me where that option is.
You don't need to stipulate that it's a vector on the UML diagram.
In the example you're giving, there is a one-to-many relationship between one class and another. That's the significant information you need to communicate.
You've chosen to implement this as a vector: this is an implementation detail that doesn't need to go on the diagram - just display a one-to-many association.
If, for some reason, you need to change this to a std::list, or a std::deque, or any other stl container, you won't need to update the diagram, because the one-to-many concept is still the same.
Remember that you are displaying an abstraction of the code. If you want to convey how all the classes conceptually relate to eachother, a UML class diagram is ideal. If somebody wants to know the details of how it's implemented, he or she can always use the diagram as a starting point before looking at the source code itself.
For an example of one-to-many relationships displayed using UML, click here