객체지향 생활 체조

March 27, 2009

“객체지향 생활 체조”는 [소트웍스 앤솔러지]에 실린 여섯 번째 글이다. 연습용 코드로 “규칙 1, 메서드당 들여쓰기 한 번”과 “규칙 2, else 금지”를 해봤는데, 생각했던 것보다 리팩토링을 더 많이 하게 되더라. :)

규칙 1은 if (foo) { if (bar) { }} 이런 경우를 금하는 거니까, ‘메서드 당 네스팅은 한 번만’이라고 해도 같은 말이 되겠다.

규칙 2는 말 그대로 else를 안쓰는 건데, 원래는 다형성이나 Null Object를 쓰라는 말이었지만 1번을 하다보니 if (foo) return bar(); 같은 짓을 하게 되면서 대부분 사라졌다. =_=;;

Entry Filed under: code. Tags: .

Leave a Comment

Required

Required, hidden

Some HTML allowed:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <pre> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Trackback this post  |  Subscribe to the comments via RSS Feed


Tags

addon android Assembly batch book C++ editor excel google InstallShield lua personal physic security wow

Recent Posts

Recent Comments

지양 on Source Insight – Browse …
조프 on Source Insight – Browse …
조프 on Source Insight – Browse …
랑탕 on Google 크롬의 Crash message
지양 on n&(n-1)

Blogroll