I do NOT understand your question actually :( as well as i can't get the reason why you MUST desc your implmentation in UML.In fact, if i was playing a designer role,i'd rather write the UML docs as we have talked above.And if i was playing a programmer role, i'd rather read these kind of UML docs too,which are enough for our coding works. More details are unnecessary, which waste your working time. I DID think i could do more valuable work instead of doing this.Don't you agree with me?
To abenzm(凤凰台) :当然A里不只有一个Map,要不然它真的没什么用?
To twinsant124(蚂蚁的天空) :你的意思是“此题无解”?Map和static问题只能到实现阶段在考虑?So your answer is : 只记录is part of关系再加上Key-Object的对应关系,Okay?
或者真是如此,以前我也确实是这么做的(因为没有办法啊)。但我真希望能够有更好的方法。
1.如果是实际开发过程,你确实没有必要在设计视图里描述那么多的关系,
根据我的经验和对你问题的理解,在设计时你只需要描述A和Object的关系(Object is part of A,
and it can exist without A,so they associate with whole-part
relation,that means aggregation.You can get the answer of their multiply urself.),然后
把它交给程序员,程序员自然会用更高精度的描述--代码来做到你的要求。我认为用UML来
描述实现没有任何价值,在实现时,作为一个程序员,我们应该用代码思考。
2.如果你非要用UML描述你的实现,你还得从你的实现里抽取概念:
首先看看有几个类:
A,MAP,Key,Object
their relations:
A is an aggregation,which aggregates with an instance of MAP.
MAP is associative class between Key & Object.
You can describe MAP using stereotype OR constraint OR etc.
4.Tips:
a.我们要描述什么问题?
b.用UML来描述是不是使问题更清楚?是不是更有利于我们解决问题?
c.Remember that UML is ONLY a language,is ONLY a kind of description.
if UML confuse you, forget it please!