달력

072010  이전 다음

일민 형이 메신저를 통해 UML 관련 내용을 물어왔다. 스프링 책을 쓰는 가운데 Dependency Injection(이하 DI)을 시각화하여 설명하기 위해 UML을 사용하는 과정에서 개념을 확인하고 있는 듯 했다. '책 쓰는 과정이 참 힘들구나'하는 생각이 잠깐 스쳤다. 일민 형이 확인하고자 하는 내용은 위키피디아 페이지에서 본 다음 사항이었다. 순간, 위키피디아에 이런 문장이 있음에 잠시 놀랐다.

A UML link is run-time relationship between instances of classifiers, while a dependency is a model-time relationship between definitions.

다른 관계된 일도 있어서 오랜만에 UML Specification을 찾았다. 위 내용에 해당하는 부분은 이렇게 쓰였다.

The presence of dependency relationships in a model does not have any runtime semantics implications, it is all given in terms of the model-elements that participate in the relationship, not in terms of their instances.

위키피디아의 설명이 내용도 쉽고, 링크(link)와 비교해서 설명해서 개념을 익히기에 좋다. 링크와 dependency 차이를 이해할 수 있는 내용을 UML Specification에서 찾아보니 Association과 link 사이의 관계에서 비슷하게 설명한 내용을 찾을 수 있다.

An association describes a set of tuples whose values refer to typed instances. An instance of an association is called a link.

이는 객체와 클래스 차이와 유사하며, 마찬가지로 실행시점과 정의시점의 차이와 유사하다.

뒤척이다가 DI와 관계된 UML 표기법을 찾았다.
사용자 삽입 이미지
The substitution relationship denotes runtime substitutability that is not based on specialization. Substitution, unlike specialization, does not imply inheritance of structure, but only compliance of publicly available contracts. A substitution
like relationship is instrumental to specify runtime substitutability for domains that do not support specialization such as certain component technologies. It requires that (1) interfaces implemented by the contract classifier are also implemented by the substituting classifier, or else the substituting classifier implements a more specialized interface type. And, (2) the any port owned by the contract classifier has a matching port (see ports) owned by the substituting classifier.

UML Superstructure Specification, v2.2 134쪽

Posted by 영회
방금 개선이 필요한 코드를 찾고 나서 바로  dependency를 줄이자??!!라는 글이 올라와서 직전의 코드 조각을 올려둔다.

사용자 삽입 이미지

자동화가 어려운 영역에 존재하는 의존은 코드를 더 관리하기 힘들게 만든다. 하지만, 이클립스의 리팩토링 기능을 활용하면 이를 극복할 수 있다.[각주:1] Tip을 하나 소개시켜 드리면 Rename 리팩토링을 위한 단축키, Alt+Shift+R을 두 번 눌러주시면 다이얼로그에 빠르게 접근하여 *.xml 파일 등에 설정한 텍스트도 리팩토링 할 수 있습니다.
  1. 무지의 소행으로 IDE로 안된다는 사실을 유포했습니다. 이를 정정해준 토비님의 애정어린(?) 태클 감사합니다. [본문으로]
Posted by 영회

The Goal(더 골)에서


Redundancy vs. Dependency


UI is yoU and I


댓글은 또하나의 롱테일(Long Tail)


마찰을 일으키지 않는다면 전진하고 있지 않은 것

Posted by 영회