header-img
Info :
728x90

์ฃผ์„[Tin]

 

1. ์ฝ”๋“œ ๋‚ด์šฉ์„ ๊ทธ๋Œ€๋กœ ๋ฐ˜๋ณตํ•˜๋Š”, ์ฆ‰ ์ถ”๊ฐ€ ์ •๋ณด๊ฐ€ ์—†๋Š” ์ฃผ์„์€ ์ ์ง€ ๋ง๋ผ.

2. ์ข‹์€ ์ฃผ์„์€ ๋ถˆ๋ช…ํ™•ํ•œ ์ฝ”๋“œ๋ฅผ ๋ณ€๋ช…ํ•˜์ง€ ์•Š๋Š”๋‹ค. - ์ฃผ์„์œผ๋กœ ์ฝ”๋“œ๋ฅผ ์„ค๋ช…ํ•˜์ง€ ๋ง๊ณ  ์ฝ”๋“œ๋ฅผ ๋‹ค์‹œ ์จ๋ผ.

3. ๋ช…ํ™•ํ•œ ์ฃผ์„์„ ์ ์„ ์ˆ˜ ์—†๋‹ค๋ฉด ์ฝ”๋“œ๋ฅผ ํšŒ๊ณ ํ•˜์ž. - ์ฝ”๋“œ๊ฐ€ ์–ด๋ ต๋‹ค๊ณ  ์ฃผ์„์œผ๋กœ ๊ฒฝ๊ณ ํ•˜์ง€ ๋ง๊ณ  ์ฝ”๋“œ๋ฅผ ๋‹ค์‹œ ์จ๋ผ.

4. ์ฃผ์„์€ ํ˜ผ๋ž€์„ ์•ผ๊ธฐํ•˜๋Š” ๊ฒƒ์ด ์•„๋‹ˆ๋ผ ํ•ด์†Œํ•ด์•ผ ํ•œ๋‹ค. - ์ฃผ์„์„ ๋ณด๊ณ  ๋” ํ—ท๊ฐˆ๋ฆฐ๋‹ค๋ฉด ๊ทธ ์ฃผ์„์€ ์ง€์šฐ๋Š” ํŽธ์ด ๋งž๋‹ค.

5. ๊ด€์šฉ์ ์ด์ง€ ์•Š์€ ์ฝ”๋“œ๋Š” ์ฃผ์„์œผ๋กœ ์„ค๋ช…ํ•˜๋ผ. - ๋ถˆํ•„์š”ํ•˜๊ฑฐ๋‚˜ ์ค‘๋ณต๋œ๋‹ค๊ณ  ์ƒ๊ฐํ•  ์ˆ˜ ์žˆ๋Š” ์ฝ”๋“œ, ์ด๋กœ ์ธํ•˜์—ฌ ๋‹ค๋ฅธ ๋ˆ„๊ตฐ๊ฐ€๊ฐ€ "๋‹จ์ˆœํ™”" ํ•  ์ˆ˜๋„ ์žˆ๋‹ค๊ณ  ์ƒ๊ฐ๋˜๋Š” ์ฝ”๋“œ๋ผ๋ฉด ์ฃผ์„์„ ๋‹ฌ์•„ ์„ค๋ช…ํ•ด๋‘๋Š” ๊ฒƒ์ด ์ข‹๋‹ค.

6. ๋ณต์‚ฌํ•œ ์ฝ”๋“œ๋ผ๋ฉด ์›๋ณธ ์ถœ์ฒ˜ ๋งํฌ๋ฅผ ์ฃผ์„์— ํฌํ•จํ•˜๋ผ.

- ํ–ฅํ›„ ์ฝ”๋“œ๋ฅผ ์ฝ์„ ๋™๋ฃŒ๊ฐ€ ์ „์ฒด ์ปจํ…์ŠคํŠธ(์–ด๋–ค ๋ฌธ์ œ, ํ•ด๋‹น ์†”๋ฃจ์…˜์ด ๊ถŒ์žฅ๋˜๋Š” ์ด์œ  ๋“ฑ)์„ ํŒŒ์•…ํ•˜๋Š” ๋ฐ ๋„์›€์ด ๋  ์ˆ˜ ์žˆ๋‹ค.

7. ๋„์›€์ด ๋  ๋งŒํ•œ ์™ธ๋ถ€ ์ฐธ์กฐ ๋งํฌ๋ฅผ ํฌํ•จํ•˜๋ผ.

8. ์ฝ”๋“œ๋ฅผ ์ˆ˜์ •ํ•  ๋•Œ, ํŠนํžˆ ๋ฒ„๊ทธ๋ฅผ ์ˆ˜์ •ํ•  ๋•Œ ์ฃผ์„์„ ์ถ”๊ฐ€ํ•˜๋ผ.

9. ์ฃผ์„์„ ์‚ฌ์šฉํ•ด ๋ถˆ์™„์ „ํ•œ ๊ตฌํ˜„์„ ํ‘œ์‹œํ•˜๋ผ. - ๊ธฐ์ˆ  ๋ถ€์ฑ„๋ฅผ ์ธก์ •ํ•˜๊ณ  ํ•ด๊ฒฐํ•˜๋Š” ๋ฐ์— ๋„์›€์ด ๋œ๋‹ค.

 

๊ทธ๋ฆฌ๊ณ  ๊ทธ์— ๋Œ€ํ•œ ์ƒ์„ธ ์„ค๋ช….

https://stackoverflow.blog/2021/12/23/best-practices-for-writing-code-comments/

 

Best practices for writing code comments

While there are many resources to help programmers write better code—such as books and static analyzers—there are few for writing better comments. While it's easy to measure the quantity of comments in a program, it's hard to measure the quality, and t

stackoverflow.blog

 

728x90
๋”๋ณด๊ธฐ
IT ๊ธฐ์ˆ /๊ธฐํƒ€