这绝对是主观的,但我想尽量避免它变成争论。我认为如果人们恰当地对待它,这将是一个有趣的问题。
这个问题的想法来自于我对“你最讨厌的语言的哪五件事?”问题的回答。我认为c#中的类在默认情况下应该是密封的——我不会把我的理由放在这个问题上,但我可能会写一个更完整的解释来回答这个问题。我对评论中的讨论热度感到惊讶(目前有25条评论)。
那么,你有什么有争议的观点?我宁愿避免那些基于相对较少的基础而导致相当宗教的事情(例如,大括号放置),但例如可能包括“单元测试实际上并没有多大帮助”或“公共字段确实是可以的”之类的事情。重要的是(至少对我来说)你的观点背后是有理由的。
请提出你的观点和理由——我鼓励人们投票给那些有充分论证和有趣的观点,不管你是否恰好同意这些观点。
让您的业务逻辑远离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.
大多数程序员都不擅长编程
(你刚才说“有争议”)
我坐在家里的办公室里思考一些编程问题,最后我看着书架上的“完整的频谱ROM拆卸”,心想:
“现在有多少程序员能写出Spectrum ROM中使用的代码?”
Spectrum,对于那些不熟悉它的人来说,有一个基本的编程语言,可以在16K的Z80代码(一个< 5Mhz的8位处理器,没有FPU或整数乘)中完成简单的2D图形(线,曲线),文件IO排序和浮点计算,包括传递函数。今天的大多数毕业生都很难编写一个这么小的“Hello World”程序。
我认为问题在于,能够做到这一点的程序员的绝对数量几乎没有变化,但作为一个百分比,它正在迅速接近于零。这意味着,随着越来越多不合格的程序员进入这个领域,所编写的代码的质量正在下降。
Where I'm currently working, there are seven programmers including myself. Of these, I'm the only one who keeps up-to-date by reading blogs, books, this site, etc and doing programming 'for fun' at home (my wife is constantly amazed by this). There's one other programmer who is keen to write well structured code (interestingly, he did a lot of work using Delphi) and to refactor poor code. The rest are, well, not great. Thnking about it, you could describe them as 'brute force' programmers - will force inappropriate solutions until they work after a fashion (e.g. using C# arrays with repeated array.Resize to dynamically add items instead of using a List).
现在,我不知道我目前所在的地方是否具有代表性,尽管从我以前的职位来看,我认为它是典型的。事后来看,我发现一些常见的模式对任何项目都没有帮助(比如缺少代码的同行评审)。
所以,7个程序员中就有5个是垃圾。
斯基兹