■
UMLモデリングレッスンの中で、"厳密には集約には関連以上の意味はない"と記載があるのですが、
自分の中の基準を明確にするため、クラスの、包含、集約、関連、依存をコードで書いてみました。
public class Test {
private Composite composite = null;//Testが削除されれば、compositeも削除される。
private Aggregation aggregation = null;//Testのライフサイクルにおいて常に関連するが、参照である。
private Assosiation assosiation = null;//Testのライフサイクルにおいて、nullもありうる。public Test(Aggregation aggregation) {
this.aggregation= aggregation;
composite = new Composite();
Dependency dependency = new Dependency();//Testのメソッド内で一時的に使用するだけ
}}