Nested (Inner) Classes

G

GMS

How do you represent a nested, or inner class in Visio? For instance:
Public Class SomePublicClass
Private Class InnerClass
'Implementation
End Class
End Class

SomePublicClass is public, so it can be seen by other classes, but
InnerClass is a private class so it exists and can only be used internally by
SomePublicClass.

It looks like the UML for this is a line with a circle at the end, and a
plus (+) sign in the circle. However, I can't find this anywhere in Visio,
and I'm not sure how to model this.

Thanks in advance, and I apologize if I'm not clear enough. I'll gladly add
more detail if necessary...
 
A

Aaron Rykhus [MSFT]

I see what you're talking about with the plus (+) sign inside a circle on
the end of one side of a connector. I believe that's called a "nesting
connector".

I know the current version of Visio implements level 1.2 of the UML
notation standard and I've seen this in UML documentation but I'm pretty
sure that was for UML level 2. Which leads me to believe that is why this
is not possible in Visio. But I'm not sure.

Do you know if inner classes were possible in level 1.2?


Aaron Rykhus, MCP, MCDST
Online Support Engineer
Microsoft Corporation
 
G

GMS

Unfortunately, I have no idea, and I can't seem to turn up a list of features
supported in 1.2 vs features in 2.0. There has to be a list SOMEWHERE, but I
can't find it... I know it was supported in 1.4 (section 3.27 of the 1.4 spec
in the official UML spec from OMG), but if Visio only supports 1.2 for some
reason...

Thanks for your help. Your answer makes sense since I spent quite a few
hours searching for help, and came up empty handed, and nobody seems to have
any idea how to do this in Visio. But, because of this, I've had to scrap
using Visio and move to ArgoUML, which provides this capability. Well, to
some extent. There is no current way to diagram the anchor relationship, but
at least you can represent it in the model. I can't seem to do this in Visio.
Weird though, since if you create a class, and reverse engineer it, the model
is created properly. however, this seems to be the only way to do this. Which
would make the model useless if I had to flesh out everything in code just to
reverse engineer it to see how the UML looks... ;-)

So, I guess the final verdict is: Visio lacks any way to specify a nested
class either in the diagram or the model. ArgoUML at least allows you to
specify it via the model, but also lacks support in the diagram.

~Geoff
 
A

Aaron Rykhus [MSFT]

From every thing I've read that shows that nesting connector says that it's
referencing UML 2. If you have a way that you get that connector to show
from reverse engineering I'd love to see it.



Best Regards,

Aaron Rykhus, MCP, MCDST
Online Support Engineer
Microsoft Corporation
 
G

GMS

Ahhh, that's the problem! There's no way to represent the connector on the
diagram. If you create a simple class with a nested class in VS, then reverse
engineer it, Visio will show the nested class properly in the model view, but
if you try and create a diagram representing that relationship, no dice. I
should mention that by "properly" I mean the nested class shows as a
sub-element of the "parent" class in the model view. There is, as far as I
can tell, no way to create a new class UNDER an existing class in the model
view in Visio itself, so reverse engineering this relationship from VS seems
to be the only way to achieve this.
I'm fairly new to Visio, so I'm COMPLETELY ready to accept that there is a
way to do what I want in the model, but I have no idea how to do it. What
would be great is if you could create a new class and either specify a parent
element as part of the creation, or create it and drag it onto the parent
element to have it nest as an inner class. Oh well, maybe in another 4 years
we'll get this in the next version... ;-)

Thanks for your help and responses. If you know a way to do what it seems
like I'm trying to do, it'd be great, but I looked for quite a while and no
help seems to exist (that has been previously offered anyway!)...

~Geoff
 
A

Aaron Rykhus [MSFT]

You can have a class inside a class by right-clicking the Class in Model
Explorer, selecting New, and clicking Class.


Aaron
 
G

GMS

Sorry, you're absolutely right! I forgot, it wasn't a sub-CLASS I was trying
to model, but an enumeration embedded within a class. You can nest a class in
the model, but not specify an enumeration as part of a particular class. Do
you know how to do this? That's what I could only achieve through reverse
engineering. Sorry for mixing the two up. Basically, if you reverse engineer
this:
Public SomeClass
Public enumeration SomeEnumwithMeaningOnlyValidInClass
OneVal = 1
TwoVal = 2
End Enum
End Class

....you'll get a model that shows the enum as part of the class. However,
there doesn't seem to be a way to do this short of creating and then reverse
engineering the code... Unless you know of some way to do this?

~Geoff
 
A

Aaron Rykhus [MSFT]

If you drop a Data Type shape onto the page (found in UML Static Structure
shapes), right-click the shape, select Data Type on the left pane, in the
Stereotype drop down choose 'enumeration', then click Enumeration under
Categories on the left. You should now be able to add as many enumerations
as you'd like.

There should be a help article on that under 'Visio for Enterprise
Architechts Help' under the Help menu in VEA.



Aaron Rykhus, MCP, MCDST
Online Support Engineer
Microsoft Corporation
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top