你遇到过的源代码中最好的注释是什么?
当前回答
// TODO: Delete
其他回答
我刚刚在。net的自定义Linq提供程序中找到了这个:
//select is a royal pain in the ass where
//the parameter passed to CreateQuery isn't actually the one that goes in the call
//requiring this workaround. Not sure how straight Linq to Objects does it.
还有这个
//expressions have to be compiled in order to work with the method call on
//straight Enumerable somehow, LINQ to objects itself magically does this.
//Reflector shows a mess, so I (Aaron) invented my own way. God love unit tests!
我刚刚也找到了这个…一切都会变得更好
//ok, this is a hairy, dirty, and nasty piece of code
//the alternatives are substantially worse than this though
//i.e. when you do your own provider, LINQ assumes that
//you are going to implement your own expression tree visitor and
//do it all yourself. Frankly, I still have xmas shopping to do
//and I really don't want us to be foobared when we get
//even more extension methods added to LINQ
//therefore, we are pulling execute based on taking the calling the
//standard execute on enumerable, but using our own class
//
//optimization can occur from here on an as needed basis, that is
//check for the value of mex.Method.Name, and write a handler for
//that method
//
//also, it may not be a bad idea to rather than do this reflection
//each and every time somehow cache the reflected methodinfos and do
//lookups that way that said, we need a complete red/green/refactor
//cycle here before I am touching that one
还有这个
//Compile that mutherf-ker, invoke it, and get the resulting hash
else
{
//error situation
}
从一个遗留的Perl CGI脚本:
# This is convoluted and evil, sorry.
以下注释来自我必须调试的一个旧项目:
//Haleluya i can go home!
这是我们团队微观管理效果的一个活生生的例子:
// I am not responsible of this code.
// They made me write it, against my will.
... 我们敬爱的技术总监很喜欢把代码和编码指南都硬塞到开发人员的喉咙里(*)。
当然,当项目负责人寻找bug的原因时,发现它在“非最佳代码”中,他就不那么高兴了……
(*)当然,我指的是强大的VB国王……如果你想评估强大的VB国王的全部力量,你可以阅读下面的SO帖子:你被迫遵循的最奇怪的编码标准规则是什么?...
推荐文章
- 在VS Code中禁用“Comments are not allowed In JSON”错误
- Swift:理解// MARK
- 在构建中编写注释的语法是什么?gradle文件?
- Java注释中的/**和/*
- 有没有办法注释掉.ASPX页面中的标记?
- Jenkins:注释可以添加到Jenkins文件中吗?
- TypeScript注释的语法记录在哪里?
- CSV文件可以有注释吗?
- 什么是自文档化代码?它能取代文档化良好的代码吗?
- 在erb中添加注释的最佳方法
- 为什么Python没有多行注释?
- 我应该在批处理文件中使用哪种注释风格?
- 如何在Office VBA编辑器中注释和取消注释代码块
- “# noqa”在Python注释中是什么意思?
- 我可以向pip需求文件添加注释吗?