2010년 4월 8일 목요일

private 멤버는 underscore를 suffix로 주는 코딩 스타일

멤버 필드의 이름 뒤에 underscore(_)를 붙이는 네이밍 방식을 구글 코딩 스타일에서 본 적이 있는데 왜 그게 좋은지 궁금했었다. 갑자기 또 생각나서 찾아봤는데 가독성 때문이란다.

"Indicating class scope by using underscore makes it easy to distinguish class variables from local scratch variables. This is important because class variables are considered to have higher significance than method variables, and should be treated with special care by the programmer. ... (중략)... latter is recommended because it seem to best preserve the readability of the name."

출처 :
http://stackoverflow.com/questions/1630412/is-using-underscore-suffix-for-members-beneficial

댓글 없음:

댓글 쓰기