开发者

Representation of Java Collections in UML2

Is there a standard representation for typed java collections in UML2? I am working on a class diagram and wo开发者_StackOverflow中文版uld like to avoid Java syntax, when using something like Map as type for a class attribute.

- foo : Map<Integer, String>


UML2 has parameterized classes, and the syntax is in fact pretty much the same as Java's - both Java and the UML spec were inspired by the C++ syntax here.


I'm against using too much design documents to program. Documents are only for communicating ideas, IMHO.

So if you need Java Types for your UML chances are:

  • you are reverse engineering: then Java Syntax will be fine

  • you are trying to program trhough UML: don't do it. Program in Java. Use UML only for object relation and collaboration

    • if the types are primitive: it's likely you don't need to express internal data structures in UML. You only need to express what's the responsibility of the class.
    • if the types are objects: ok, maybe it's the point... I'm not sure, but try to use the minimum...
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜