Re: UML: Associations between classes and packages



H. S. Lahman wrote:
Responding to Kaeppler...

I was wondering in how far it is allowed to mix class and package diagrams in UML.


Classes and packages in an OO context using UML are used for rather different things. Packages are usually employed to describe configuration management issues (e.g., which model elements -- like classes -- belong to which releases). Classes, OTOH, have problem space semantics for the solution.


Example:
Say I have a class which inherits from javax.swing.JFrame. It would be stupid to introduce the class JFrame with its huge interface into the model, since it's part of the platform anyway.
But somehow I have to model the relationship between my custom Frame class and JFrame, so I thought I'd just draw a dependency from my class to the swing package. But the I'd have both classes and packages together in one diagram.


Is that legal? And if so, what kind of line notation do I have to use, a simple dotted line?


I don't use Java, so I can't comment specifically. However, since JFrame seems to be a realize infrastructure I would guess the best way to represent it would be as an architectural subsystem using the <<subsystem>> stereotype. That effectively encapsulates it as a single Component with an interface and attributes that the other classes can access. (In UML the <<subsystem>> is defined as a stereotype of Component, which, in turn, is derived from Class.)


************* There is nothing wrong with me that could not be cured by a capful of Drano.

H. S. Lahman
hsl@xxxxxxxxxxxxxxxxx
Pathfinder Solutions  -- Put MDA to Work
http://www.pathfindermda.com
blog: http://pathfinderpeople.blogs.com/hslahman
(888)OOA-PATH




That means I would have to introduce JFrame as a class?
The problem is, that someone could argue I would then also have to introduce Object (in Java it's the implicit base class of all classes) for the sake of completeness and I will soon find myself remodelling half of the Java platform.
That's why I asked, whether it's a good idea in general to model classes of the platform or not.


--
Matthias Kaeppler
.



Relevant Pages

  • Re: SDL -> UML 2 Book ?
    ... >> Did you swap UML and SDL in your sentence? ... In protocol, the higher architecture level is the protocol ... > just using packages, much as you use boxes in SDL. ...
    (comp.object)
  • Re: UML: Associations between classes and packages
    ... diagrams in UML. ... Packages are usually employed to describe configuration management issues. ... But somehow I have to model the relationship between my custom Frame class and JFrame, so I thought I'd just draw a dependency from my class to the swing package. ...
    (comp.object)
  • Re: UML Static Structure Diagrams
    ... Unfortunately by the sounds of it Visio won't ... Because I essentially have packages within packages, ... this is tricky to change the behavior of the UML ... The next level of diagrams I want is a mid level diagram, ...
    (microsoft.public.visio.software.modeling)
  • Re: Difference package/component
    ... UML packages are typically used to group classes in ... if you are doing code driven versus model driven development, ...
    (comp.object)
  • Re: Drawing algorithm diagrams and conceptual figures
    ... I'm writing my master thesis and have to draw diagrams and figures ... Could you recommend some packages or stand-alone software to do this? ... Block diagrams are surprisingly hard to create unless you have a good ...
    (comp.text.tex)