Skip to content

Tips for Class Connection Representation using PlantUML

2017년 2월 20일

Distinguishing connecting representation.

Extension <|-- extension symbol
Composition *-- composition symbol
Aggregation o-- aggregation symbol

Normaly developers used to 3 types of line such as Extension, Composition and Aggregation for representing connectivity of classes.

For detail, let me explain each ones.

Extension is most simple. If you extend class using some interface or some abstract class then use Extension line that directed to upper interface or class.

Composition and Aggregation is little bit similar but I can explain differencies few point. Composition is used when class was directly used inside of directed class, that means that class has the property of other class. Aggregation is used when class was used to arguments of some functions or constructors. Aggregation doesn’t used for declaring inside of targeted class.

Let me show with examples.

Extension

class A2 extends A {
}

A2 -|> A

Composition

class A {
    B b = new B();
    B get(){
        return this.b;
    }
}

B -* A

Aggregation

class A {
    void use(B b){
        b.use();
    }
}

B -o A

Three types of connectivity can be explanin most of case the class structure, but if we need to some extended explaination, use note representation. That will be more clear then use other type of connection representation.

Advertisements
댓글 남기기

답글 남기기

아래 항목을 채우거나 오른쪽 아이콘 중 하나를 클릭하여 로그 인 하세요:

WordPress.com 로고

WordPress.com의 계정을 사용하여 댓글을 남깁니다. 로그아웃 / 변경 )

Twitter 사진

Twitter의 계정을 사용하여 댓글을 남깁니다. 로그아웃 / 변경 )

Facebook 사진

Facebook의 계정을 사용하여 댓글을 남깁니다. 로그아웃 / 변경 )

Google+ photo

Google+의 계정을 사용하여 댓글을 남깁니다. 로그아웃 / 변경 )

%s에 연결하는 중

%d 블로거가 이것을 좋아합니다: