Fundamentals 2 min read

Should You Add Comments to Your Code? – Insights from Refactoring

This discussion post examines whether code should be commented, citing the book *Refactoring* and emphasizing that needing comments often signals the need for refactoring, while good variable names can serve as implicit documentation, and stresses the importance of clear interface comments.

360 Quality & Efficiency
360 Quality & Efficiency
360 Quality & Efficiency
Should You Add Comments to Your Code? – Insights from Refactoring

//你的代码加注释吗?

//纯讨论帖,欢迎留言(拍砖)~

《重构》里面说,如果你的代码需要加注释,才能看明白,说明代码该重构了。没有注释的代码不是好代码,变量名本身就是一种注释手段。

不写注释,必须拖出去打死!复杂业务加少量注释,简单业务用变量名标记啦。要加要加,不然我真的看不懂以前大师(屎)的神逻辑。

模块外部接口必须加注释说明。是没功夫写,还是不愿意写?你说清楚。要写就好好写,不要错别字。

代码到底加不加注释?

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

software-engineeringbest practicescoding standardscode commentsrefactoring
360 Quality & Efficiency
Written by

360 Quality & Efficiency

360 Quality & Efficiency focuses on seamlessly integrating quality and efficiency in R&D, sharing 360’s internal best practices with industry peers to foster collaboration among Chinese enterprises and drive greater efficiency value.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.