8월 2, 2009

Namespace의 목적

Framework Design Guidelines 2nd Edition일반적으로 알고 있는 것 과 달리, Namespace의 주 목적은 이름을 가진 타입들의 충돌을 해결하고자 하는 것이 아니다

Namespace의 주 목적은  응집력 있고, 쉽게 찾을수 있으며, 쉽게 이해할 수 있는 계층구조로 타입들을 구성하는 것이다.

하나의 프레임워크 안에 타입 이름의 충돌은 조잡한 디자인을 나타낸다고 생각한다.

동일한 이름을 가진 타입들은 더 나은 통합을 위해  라이브러리의 특정 부분들을  합치거나, 코드의 읽기와 검색을 향상시키기 위해서 새로운 이름을 할당하는 것이 좋다.

출처 – Framework Design Guidelines 2nd Edition.

Contrary to popular belief, the main purpose of namespaces is not to help in resolving naming conflicts between types with the same name.

As the guideline states, the main purpose of namespaces is to organize types in a hierarchy that is coherent, easy to navigate, and easy to understand.

I consider type-name conflicts in a single framework to indicate sloppy design.

Types with identical names should either be merged to allow for better integration between parts of the library or be renamed to improve code readability and searchability.

답글 남기기

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

WordPress.com 로고

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

Twitter 사진

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

Facebook 사진

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

%s에 연결하는 중

This site uses Akismet to reduce spam. Learn how your comment data is processed.

카테고리

Framework, Software Architecture, Software Engineering

태그

, ,