这绝对是主观的,但我想尽量避免它变成争论。我认为如果人们恰当地对待它,这将是一个有趣的问题。

这个问题的想法来自于我对“你最讨厌的语言的哪五件事?”问题的回答。我认为c#中的类在默认情况下应该是密封的——我不会把我的理由放在这个问题上,但我可能会写一个更完整的解释来回答这个问题。我对评论中的讨论热度感到惊讶(目前有25条评论)。

那么,你有什么有争议的观点?我宁愿避免那些基于相对较少的基础而导致相当宗教的事情(例如,大括号放置),但例如可能包括“单元测试实际上并没有多大帮助”或“公共字段确实是可以的”之类的事情。重要的是(至少对我来说)你的观点背后是有理由的。

请提出你的观点和理由——我鼓励人们投票给那些有充分论证和有趣的观点,不管你是否恰好同意这些观点。


当前回答

记事本是一个完美的文本编辑器。(有时是非窗口换行符的写字板)

编辑配置文件 查看日志文件 发展

我知道有人真的相信这一点!然而,他们将使用IDE进行开发,但继续使用记事本进行其他一切!

其他回答

永远不要让最佳实践或模式困扰成为你的奴隶。

这些应该是指导方针,而不是一成不变的法律。

我真的很喜欢这些模式,GoF的书或多或少也是这么说的,这些东西可以浏览,提供了一个常见的术语。这不是无稽之谈。

这不是关于编程的,因为html/css不是编程语言。

表格可以用于布局

CSS和div不能做所有的事情,节省你自己的麻烦,使用一个简单的表,然后在它上面使用CSS。

设计模式是石器时代编程语言设计的一个症状

他们有自己的目的。很多优秀的软件都是用它们开发出来的。但事实上,我们需要编写这些心理抽象的“配方”,关于你的代码如何工作/应该如何工作,这说明缺乏足够有表现力的编程语言来为我们处理这种抽象。

补救措施,我认为,在于允许你将越来越多的设计嵌入到代码中的语言,通过定义可能不存在或可能没有普遍适用性,但在你的代码不断处理的情况下真的真的有意义的语言结构。Scheme的人已经知道这一点很多年了,Scheme宏可能会让大多数猴子尿裤子。

你的工作就是让自己失业。

当您为您的雇主编写软件时,您所创建的任何软件都应该以这样一种方式编写,即任何开发人员都可以使用它,并且可以用最少的努力理解它。它设计良好,编写清晰一致,格式化干净,在需要的地方有文档记录,按照预期每天构建,检入存储库,并进行了适当的版本控制。

如果你被公共汽车撞了,被解雇了,被解雇了,或者离开了工作岗位,你的雇主应该能够在片刻的通知中取代你,下一个人可以接替你的角色,拿起你的代码,最多在一周内启动并运行。如果他或她不能做到这一点,那么你就失败了。

有趣的是,我发现有了这个目标,我对雇主来说更有价值了。我越努力成为可有可无的人,我对他们就越有价值。

生成文档良好的代码比生成文档不良的代码花费的时间更少

When I say well-documented I mean with comments that communicate your intention clearly at every step. Yes, typing comments takes some time. And yes, your coworkers should all be smart enough to figure out what you intended just by reading your descriptive function and variable names and spelunking their way through all your executable statements. But it takes more of their time to do it than if you had just explained your intentions, and clear documentation is especially helpful when the logic of the code turns out to be wrong. Not that your code would ever be wrong...

I firmly believe that if you time it from when you start a project to when you ship a defect-free product, writing well-documented code takes less time. For one thing, having to explain clearly what you're doing forces you to think it through clearly, and if you can't write a clear, concise explanation of what your code is accomplishing then it's probably not designed well. And for another purely selfish reason, well-documented and well-structured code is far easier to dump onto someone else to maintain - thus freeing the original author to go create the next big thing. I rarely if ever have to stop what I'm doing to explain how my code was meant to work because it's blatantly obvious to anyone who can read English (even if they can't read C/C++/C# etc.). And one more reason is, frankly, my memory just isn't that good! I can't recall what I had for breakfast yesterday, much less what I was thinking when I wrote code a month or a year ago. Perhaps your memory is far better than mine, but because I document my intentions I can quickly pick up wherever I left off and make changes without having to first figure out what I was thinking when I wrote it.

这就是为什么我能很好地编写文档——不是因为我觉得编写适合展示的漂亮代码是一种崇高的使命,也不是因为我是一个纯粹主义者,而只是因为端到端让我在更短的时间内发布高质量的软件。