개발&Development/프로그래밍 일반

주석은 쓸모 없는것.

겐도 2005. 2. 21. 10:23
인터넷에서 우연히 찾은 링크.

Why I Don't Read Code Comments By Dr. Heinz Kabutz, from DevX

중간 내용을 인용해 보면
My dislike of comments is based on the following reasoning:
* In most cases, comments are written by programmers who don't believe in them.
* Comments rarely reflect what is really happening in the code.
* Well-written code should not need comments. Of course, there are exceptions. For example, interfaces need very detailed comments to define the various conditions. If you have methods named f(), g(), and h(), you will need to document what the methods do. But why not call them something sensible in the first place?
* Instead of writing long pre- and post-conditions in the comments, why not write extensive unit tests?

나도 주석은 많을 수록 좋다라고 배워왔지만 주석도 절제의 미가 있어야 하는법. 코드 자체가 명확히 의미를 전달할 수 있어야 하고 특이사항에 대해서는 그것을 주석으로 설명하기 보다는 그런 것이 없도록 만들어야 될것이다.