这绝对是主观的,但我想尽量避免它变成争论。我认为如果人们恰当地对待它,这将是一个有趣的问题。
这个问题的想法来自于我对“你最讨厌的语言的哪五件事?”问题的回答。我认为c#中的类在默认情况下应该是密封的——我不会把我的理由放在这个问题上,但我可能会写一个更完整的解释来回答这个问题。我对评论中的讨论热度感到惊讶(目前有25条评论)。
那么,你有什么有争议的观点?我宁愿避免那些基于相对较少的基础而导致相当宗教的事情(例如,大括号放置),但例如可能包括“单元测试实际上并没有多大帮助”或“公共字段确实是可以的”之类的事情。重要的是(至少对我来说)你的观点背后是有理由的。
请提出你的观点和理由——我鼓励人们投票给那些有充分论证和有趣的观点,不管你是否恰好同意这些观点。
源文件太20世纪了。
在函数/方法的主体中,将过程逻辑表示为线性文本是有意义的。即使逻辑不是严格的线性,我们也有良好的编程结构(循环、if语句等),允许我们使用线性文本清晰地表示非线性操作。
But there is no reason that I should be required to divide my classes among distinct files or sort my functions/methods/fields/properties/etc in a particular order within those files. Why can't we just throw all those things within a big database file and let the IDE take care of sorting everything dynamically? If I want to sort my members by name then I'll click the member header on the members table. If I want to sort them by accessibility then I'll click the accessibility header. If I want to view my classes as an inheritence tree, then I'll click the button to do that.
Perhaps classes and members could be viewed spatially, as if they were some sort of entities within a virtual world. If the programmer desired, the IDE could automatically position classes & members that use each other near each other so that they're easy to find. Imaging being able to zoom in and out of this virtual world. Zoom all the way out and you can namespace galaxies with little class planets in them. Zoom in to a namespace and you can see class planets with method continents and islands and inner classes as orbitting moons. Zoom in to a method, and you see... the source code for that method.
基本上,我的观点是,在现代语言中,不管你把你的类放在什么文件中,或者你定义一个类的成员的顺序是什么,那么为什么我们仍然被迫使用这些古老的实践呢?还记得Gmail出来谷歌说的是"搜索,不排序"吗?那么,为什么同样的哲学不能应用于编程语言呢?
编程挣钱通常是对男人时间最糟糕的利用之一。
首先,你是在和埃尔博尼亚人竞争,他们每天只挣25美分。你需要说服你的雇主,你能提供埃尔博尼亚人永远无法提供的东西,而且你的东西值得一份体面的薪水。随着埃尔博尼亚人获得越来越多的海外业务,真正的优势逐渐消失,管理层也明白这一点。
另一方面,你是在花时间解决别人的问题。这些时间你可以用来发展自己的兴趣,或者解决你真正感兴趣的问题。如果你认为解决别人的问题就能拯救世界,那你为什么不让埃尔博尼亚人为你解决问题呢?
最后,软件领域的伟大创新(visicalc、Napster、Pascal等)不是由小隔间农场创造的。它们是由一两个没有预支工资的人创建的。你不能强行重建它。当一个有能力的程序员有一个非常好的想法时,这就是奇迹。
有足够的软件。有足够多的软件开发人员。你不需要被雇佣。节省你的才华,你的时间,你的头发,你的婚姻。让别人把灵魂出卖给键盘吧。如果你想编程,没问题。但不是为了钱。