Strange behaviour with Components

0 votes
asked Jan 14, 2015 in To be sorted by wolfgang_fahl (160 points)
This works:

<uml>
class c1i {
}
</uml>
<uml>
component comp1  {

}
component comp2 {
}
</uml>
 

This does not:

<uml>
class c1i {
}
component comp1  {

}
component comp2 {
}
</uml>

 

Why? Is it a bug?

1 Answer

0 votes
answered Jan 14, 2015 by plantuml (295,000 points)


At the very beginning (5 years ago?), PlantUML was very restrictive : it was not possible to mix class/usecase/component into the same diagram.
After a while, some users complains about this, and we have started to slightly change this behaviour.

Nowdays, there are two kind of diagrams (appart from sequence, activity, state...):
- class diagrams.
- usecase/component/actor diagrams.

This means that you can mix usecases/components/actors in the same diagram.
But you cannot have classes (this is basically due to the fact that some features, like association classes, are specific to class diagrams).

Some users still complain, so, for class diagrams, we have added a new keyword "allow_mixing" to denotate that some class diagrams can have actor or usecase.
So this is working:
@startuml
allow_mixing
class cl1 {
}
actor comp1
usecase comp2
@enduml


This does not include component yet.
So this is not working:
@startuml
allow_mixing
class cl1 {
}
actor comp1
usecase comp2
component comp3
@enduml


If you wish, we can add component there. Would it be helpfull?

Our final wish is that some days, this "allow_mixing" keyword will not be needed any more, but up to now, it's the best solution we have.

Regards,
 

commented Jan 14, 2015 by wolfgang_fahl (160 points)
Since PlantUML has "UML" in its name there might be at least some UML semantics. Packages and Components and Namespaces have a common behaviour - they add scope and are containers for classifiers. This is the least i'd expect to stick to "the principle of least astonishment". If you have compatibility problems already since your are not UML compliant it might be useful to have a "strict" UML mode that is fully uml compliant. I am repeating my offer of two years ago here for an XMI import addition to plantuml if you want to have that. Just contact me via e-mail or my webpage web.bitplan.com.
commented Jan 19, 2015 by anonymous
You asked: If you wish, we can add component there. Would it be helpfull?

It's not only helpful - it would be a showstopper if it is not available. Personally I consider this mandatory.  So it would be just great to get it!
commented Jan 19, 2015 by plantuml (295,000 points)
Ok, we've just published a beta
https://dl.dropboxusercontent.com/u/13064071/plantuml.jar

That supports this:

@startuml
allow_mixing
class foo1
usecase foo2
actor foo3
foo1 -- foo2
component comp3
@enduml

Few tests have been done, so feedback is welcome!
...