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

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

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

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


当前回答

代码即设计:Jack W. Reeves的三篇文章

任何软件的源代码都是其最准确的设计文档。其他的一切(规格,文档,有时还有注释)要么是不正确的,过时的,要么是误导性的。

肯定会让你在任何地方被炒。

其他回答

Tcl/Tk是有史以来最好的GUI语言/工具包组合

它可能缺少特定的小部件,外观也不如新产品好看,但它的模型很优雅,而且易于使用,因此通过交互式输入命令可以比使用可视化界面构建器更快地构建工作gui。它的表达能力是无与伦比的:其他解决方案(Gtk、Java、. net、MFC……)通常需要10到100个LOC才能得到与Tcl/Tk一行程序相同的结果。所有这些都不会牺牲可读性和稳定性。

pack [label .l -text "Hello world!"] [button .b -text "Quit" -command exit]

详细的设计是浪费时间,如果一个工程师需要它们来做一份体面的工作,那么就不值得雇佣它们!

好的,这里有几个想法:

1) the old idea of waterfall development where you supposedly did all your design up front, resulting in some glorified extremely detailed class diagrams, sequence diagrams etc. etc., was a complete waste of time. As I once said to a colleague, I'll be done with design once the code is finished. Which I think is what agile is partly a recognition of - that the code is the design, and that any decent developer is continually refactoring. This of course, makes the idea that your class diagrams are out of date laughable - they always will be.

2) management often thinks that you can usefully take a poor engineer and use them as a 'code monkey' - in other words they're not particularly talented, but heck - can't you use them to write some code. Well.. no! If you have to spend so much time writing detailed specs that you're basically specifying the code, then it will be quicker to write it yourself. You're not saving any time. If a developer isn't smart enough to use their own imagination and judgement they're not worth employing. (Note, I'm not talking about junior engineers who are able to learn. Plenty of 'senior engineers' fall into this category.)

让您的业务逻辑远离DB。或者至少,保持它非常精简。让DB做它应该做的事情。让代码做它应该做的事情。时期。

If you're a one man show (basically, arrogant & egotistical, not listening to the wisdom of others just because you're in control), do as you wish. I don't believe you're that way since you're asking to begin with. But I've met a few when it comes to this subject and felt the need to specify. If you work with DBA's but do your own DB work, keep clearly defined partitions between your business objects, the gateway between them and the DB, and the DB itself. If you work with DBA's and aren't allowed to do your DB work (either by policy or because they're premadonnas), you're very close to being a fool placing your reliance on them to get anything done by putting code-dependant business logic in your DB entities (sprocs, functions, etc.). If you're a DBA, make developers keep their DB entities clean & lean.

关联数组/哈希映射/哈希表(无论它在你最喜欢的语言中叫什么)是自切片面包以来最好的东西!

当然,它们提供了从键到值的快速查找。但它们也使动态构造结构化数据变得容易。在脚本语言中,它通常是表示结构化数据的唯一(至少是最常用的)方法。

恕我直言,它们是许多脚本语言成功的一个非常重要的因素。

甚至在c++中std::map和std::tr1::unordered_map帮助我更快地编写代码。

引用已故的E. W. Dijsktra的话:

编程是应用数学中最难的分支之一;贫穷的数学家最好还是做纯粹的数学家。

计算机科学与计算机无关,就像天文学与望远镜无关一样。

我不明白一个人怎么能声称自己是一个合格的程序员,却不能解决像这个这样非常简单的数学问题。可能是一个CRUD猴子,但不是一个程序员。