After taking SCEA part 1 and Core Spring, it is time to work on SCEA part 2. Or should I say Oracle Certified Master, Java EE 5 Enterprise Architect part 2. OCMJEA? It doesn’t matter. This post isn’t about the SCEA/OCMJEA per se. This post is about using Visio for current Java UML modeling. Here’s what I learned or re-learned about Visio.
Why Visio?
You may be wondering why I chose Visio in the first place. After all Star UML is free. My original thought was that I have Visio 2002 installed on my machine because I bought a copy when I was in grad school and I am experienced in using it. In hindsight this wasn’t the best idea.
UML 1 vs UML 2
Visio does not support UML 2. The SCEA wants UML 2 diagrams. It looks like the biggest differences are conditional support for sequence diagrams and a new shape for components in component diagrams.
Luckily there are UML 2 stencils for Visio for almost every version of Visio. Installing them was easy. It is key to install the stencil before you start creating diagrams as Visio UML shapes can’t integrate with a UML 2 stencil diagram. The stencils don’t have much documentation, but I found this chart helpful.
Java stereotypes
To add new stereotypes for Java to a diagram, follow these steps to register them. Then just select the relevant stereotype in your diagram.
- UML menu > Stereotypes
- New
- Stereotype = @Entity (or whatever you want to add)
- Baseclass = Class, Component or Dependency (depending on the type of diagram)
Java types
To add Java specific types, follow these steps to register them in your diagram. Then select them in your attributes/operations/methods.
- UML > Packages
- New
- Java types
- UML > View > Model Explorer
- Right click java types in model explorer > new >
- datatype > name
Hiding attributes/operations section in a class diagram
- Right click shape
- Shape display options
- under suppress, click attributes or options
Add documentation to shape in component diagram
- Right click shape
- Shape display options
- Check properties
- Can add custom property (or documentation) with more detail