'Abbreviations'에 해당되는 글 1건

  1. 2007/02/24 Abbreviations : Manager, BO, Util, etc (7)

클래스 이름이나 메소드 이름에 prefix나 suffix를 붙여서 명명을 많이 한다. suffix도 유행이 있는거 같다. 과거에는 주로 Manager와 util이 큰 유행을 하였느나, 최근에는 BO나 Support 등등이 유행을 하고 있다.

suffix를 모두 붙이는 가장 큰 이유중의 하나는 AOP를 위해서 명명규칙을 정해둔 것이다. 하지만, 세부적으로 정하지 않고, DAO나 VO를 제외한 모든 클래스를 BO로 두기에는 너무 두리뭉실하다. 인터셉터들을 만들때 반이상이 넘어가는 suffix라면 벌써 의미를 잊어 버린 것이다.

다음과 같은 글을 읽어보자.
Abbreviations in class and  method names are problematic. They can be okay when they are used consistently, but in general, I don't like to use them

One team i worked with attempted to use the words manager and management in nearly every class name in the system. That naming  convention didn't help much, but what made it worse was the fact that they abbreviated manager and management in an incredible number of different ways. For example, some classes were named XXXXMgr, and others were named XXXXMngr. When you were ready to use a class you actually had to look it up most of the time to see if you had the name right. More then 50 percent of the time, I was wrong when I attempted to guess which suffix was used for a particular class.

Working Effectively With Legacy Code (Paperback)

Feathers, Michael C. / Prentice Hall

최근에 코드를 보면 습관적으로 붙이는 BO라는 suffix를 보았을 때 이제는 좀 지겹다..^^

애매한 suffix들 Manager, Util, BO, etc이 도메인 모델(엔티티, VO)을 제외하고 모든 클래스에 붙어있지는 않은지?  다시 한번 자신의 코드를 확인해보고, 스페셜한 경우의 suffix가 아닌 의무적인 suffix가 되어 버렸을 때 그 네이밍에 대해서 경계를 하자. 진정한 의미를 이름에 담아보자

올해는 네이밍을 멋지게 만드는 법을 연습해야겠다.
고민하다가 클래스 이름 하나 만들었다. TasksAfterPosting

Facade만 suffix를 반드시 붙이고, 다른 클래스들은 의미에 맞게 sufffix들을 만들어 줘야 겠다.

Posted by ologist
이전버튼 1 이전버튼

블로그 이미지
ologist

공지사항

Yesterday171
Today52
Total34,795

달력

 « |  » 2012.02
      1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29      

최근에 받은 트랙백

글 보관함