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

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

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

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


当前回答

你必须懂C才能称自己为程序员!

其他回答

一幅画不如一千个词。

有些图片可能胜过千言万语。大多数都不是。这句陈词滥调大多是不真实的,是许多懒惰的经理的可悲借口,他们不想仔细阅读创建的报告和文档,说“我需要你在图表中展示给我看”。

我妻子学的是语言学专业,她看到了一些关于图片和标志的令人着迷的证据:它们不能打破语言和文化的障碍,它们通常不能像正确的文本那样传达那么多的信息,它们根本不能取代真正的交流。

特别是,如果线条未被标记且无法解释,并且/或如果每一行都有不同的含义而不是表示相同的关系(除非以某种方式彼此区分),那么与线条连接的标记气泡是无用的。如果你的线条有时表示关系,有时表示动作,有时表示时间的流逝,你就真的完蛋了。

每个优秀的程序员都知道你使用的工具适合手头的工作,对吗?并不是所有的系统都最好用图片来说明和记录。图形化规范语言可以自动转换为可证明正确的可执行代码或任何东西,这是一个了不起的想法,如果这样的东西存在的话。在适当的时候使用它们,而不是在阳光下的所有事情上。实体-关系图很棒。但并不是所有的事情都可以用一张图片来概括。

注:一张桌子可能值同等重量的金子。但是表格和图片不是一回事。同样,一篇精心设计的短散文段落可能更适合手头的工作。

大多数开发人员对此一无所知

是的. .好了。我说过了。我从我认识的所有开发者身上发现了这一点。只有少数是真正好的。只有少数人明白代码应该被测试……面向对象的开发方法实际上是在帮助你。让我感到沮丧的是,有些人获得了开发人员的头衔,而实际上他们所能做的只是复制和粘贴一些源代码,然后执行它。

无论如何……我很高兴像stackoverflow这样的项目已经开始了。这对开发人员来说是件好事。有没有更好的办法?我做对了吗?也许我可以用这个技巧来加快速度,等等……

但是不行……大多数开发人员只是学习一种工作需要的语言,并坚持使用它,直到他们自己变成了老而暴躁的开发人员,不知道发生了什么。他们得到的只是一大笔薪水,因为他们只是比你大。

好吧……IT界的生活是不公平的,我将采取措施在未来忽略这些人。万岁!

您不应该停留在您发现的编写“有效”代码的第一种方法上。

I really don't think this should be controversial, but it is. People see an example from elsewhere in the code, from online, or from some old "Teach yourself Advanced Power SQLJava#BeansServer in 3.14159 minutes" book dated 1999, and they think they know something and they copy it into their code. They don't walk through the example to find out what each line does. They don't think about the design of their program and see if there might be a more organized or more natural way to do the same thing. They don't make any attempt at keeping their skill sets up to date to learn that they are using ideas and methods deprecated in the last year of the previous millenium. They don't seem to have the experience to learn that what they're copying has created specific horrific maintenance burdens for programmers for years and that they can be avoided with a little more thought.

事实上,他们似乎甚至没有意识到做一件事可能有不止一种方法。

I come from the Perl world, where one of the slogans is "There's More Than One Way To Do It." (TMTOWTDI) People who've taken a cursory look at Perl have written it off as "write-only" or "unreadable," largely because they've looked at crappy code written by people with the mindset I described above. Those people have given zero thought to design, maintainability, organization, reduction of duplication in code, coupling, cohesion, encapsulation, etc. They write crap. Those people exist programming in every language, and easy to learn languages with many ways to do things give them plenty of rope and guns to shoot and hang themselves with. Simultaneously.

But if you hang around the Perl world for longer than a cursory look, and watch what the long-timers in the community are doing, you see a remarkable thing: the good Perl programmers spend some time seeking to find the best way to do something. When they're naming a new module, they ask around for suggestions and bounce their ideas off of people. They hand their code out to get looked at, critiqued, and modified. If they have to do something nasty, they encapsulate it in the smallest way possible in a module for use in a more organized way. Several implementations of the same idea might hang around for awhile, but they compete for mindshare and marketshare, and they compete by trying to do the best job, and a big part of that is by making themselves easily maintainable. Really good Perl programmers seem to think hard about what they are doing and looking for the best way to do things, rather than just grabbing the first idea that flits through their brain.

如今,我主要在Java世界中编程。我见过一些非常好的Java代码,但我也见过很多垃圾代码,而且我还看到了更多我在开头描述的心态:人们选择了第一个看起来可以工作的丑陋代码块,而不理解它,也不考虑是否有更好的方法。

You will see both mindsets in every language. I'm not trying to impugn Java specifically. (Actually I really like it in some ways ... maybe that should be my real controversial opinion!) But I'm coming to believe that every programmer needs to spend a good couple of years with a TMTOWTDI-style language, because even though conventional wisdom has it that this leads to chaos and crappy code, it actually seems to produce people who understand that you need to think about the repercussions of what you are doing instead of trusting your language to have been designed to make you do the right thing with no effort.

我确实认为你可能会在另一个方向上走得太远:例如,完美主义完全忽略了你的真正需求和目标(通常是你的业务的真正需求和目标,通常是盈利能力)。但我不认为任何人都能成为一个真正伟大的程序员,除非学会投入一些高于平均水平的努力来思考寻找最好的(或至少是最好的一种)方法来编码他们正在做的事情。

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

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

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

顾客并不总是对的。

在我处理的大多数情况下,客户是产品所有者,也就是“企业”。通常情况下,开发人员只是编写代码,而不试图在产品中提供既定的利益。人们有太多的误解,认为IT部门是“公司中的公司”,这完全是一堆垃圾。

I feel my role is that of helping the business express their ideas - with the mutual understanding that I take an interest in understanding the business so that I can provide the best experience possible. And that route implies that there will be times that the product owner asks for something that he/she feels is the next revolution in computing leaving someone to either agree with that fact, or explain the more likely reason of why no one does something a certain way. It is mutually beneficial, because the product owner understands the thought that goes into the product, and the development team understands that they do more than sling code.

这实际上已经开始引导我们走上提高生产力的道路。如何?由于双方的分歧已经改善了沟通,我们更有可能在过程中更早地走到一起,并就产品定义达成一个互利的解决方案。