最近Stack Overflow上有一群讨厌perl的人,所以我想我应该把我的“关于你最喜欢的语言你讨厌的五件事”的问题带到Stack Overflow上。拿你最喜欢的语言来说,告诉我你讨厌它的五件事。这些可能只是让你烦恼的事情,承认的设计缺陷,公认的性能问题,或任何其他类别。你只需要讨厌它,它必须是你最喜欢的语言。

不要拿它和其他语言比较,也不要谈论你已经讨厌的语言。不要用你最喜欢的语言谈论你喜欢的事情。我只是想听到你讨厌但能容忍的东西,这样你就可以使用所有其他的东西,我想听到你希望别人使用的语言。

每当有人试图把他们最喜欢的语言强加给我时,我就会问这个问题,有时是面试问题。如果有人找不出他最喜欢的工具的5个缺点,那他对它还不够了解,不能提倡它,也不能利用它赚大钱。他还没有在足够多的不同情况下使用它来充分探索它。他把它作为一种文化或宗教来倡导,这意味着如果我不选择他最喜欢的技术,我就错了。

我不在乎你用什么语言。不想使用特定的语言?那就不要。你通过尽职调查做出了明智的选择,但仍然没有使用它?好吧。有时正确的答案是“你有一个强大的编程团队,有良好的实践和丰富的Bar经验。改成Foo是愚蠢的。”


This is a good question for code reviews too. People who really know a codebase will have all sorts of suggestions for it, and those who don't know it so well have non-specific complaints. I ask things like "If you could start over on this project, what would you do differently?" In this fantasy land, users and programmers get to complain about anything and everything they don't like. "I want a better interface", "I want to separate the model from the view", "I'd use this module instead of this other one", "I'd rename this set of methods", or whatever they really don't like about the current situation. That's how I get a handle on how much a particular developer knows about the codebase. It's also a clue about how much of the programmer's ego is tied up in what he's telling me.

憎恨并不是衡量人们了解多少的唯一尺度,但我发现它是一个相当不错的尺度。他们讨厌的事情也让我知道他们对这个话题的思考有多好。


当前回答

方案:

缺乏用户/社区小

其他回答

C++

太容易随机破坏内存并创建几乎不可能找到的错误(尽管Valgrind在修复这个问题上走了很长的路)。 模板错误消息。 在使用模板时,很容易将所有内容都包含在一个文件中,然后进行愚蠢的编译。 标准库在现代是一个笑话(默认情况下仍然没有线程或网络?) 大量令人讨厌的C语言(特别是所有在short/int/unsigned/等之间的转换)。

Scala是我最喜欢的语言。五件讨厌的事?容易:

Takes a long time to learn properly. I know you can write Scala as a 'better java'. That is what we used to say about C++ and C too. I agree this is an inevitable consequence of the deep ideas in the language. But still ... Methods vs. Functions: def f(x: Int) = x*x defines a method f, not a function f. Methods are not functions despite a lot of early Scala tutorial material blurring the distinction. The language tries to blur it too because if you supply a method in some places where a function is expected it is accepted. Do we have to have both methods and functions? Yes it is fundamental. But it was initially confusing to me. Composing classes or objects from mixins in the 'cake' pattern is prone to NPE's. e.g. trait X { val host: String; val url = "http://" + host } is a mixin that will NPE on instantiation, or not, depending on its position in the class declaration. The compiler could tell you if it will fail but doesn't. (In 2.7 anyway.) It is hard to diagnose the problem in complex inheritance graphs. Arrays in 2.8 rely on implicits to mesh with the main scala collection types. But implicits are not applied everywhere. An Array can be supplied where a Seq is expected. But an Option[Array] cannot be supplied where an Option[Seq] is expected. I know there are no completely 'right' ways to handle java Arrays. Type erasure. Enough said.

Python

Standard library disobeys their own style guidelines in many places. (PEP-8) Py3k's super keyword is full of unwanted magic (you can't assign it to a different name, works without self, why do we have this explicit parameter at all?) Unicode support is incomplete in Py2k and sucks in Py3k (standard input in unicode, no binary data! WTF? Creating a new WSGI standard is hacky.) The GIL. Very limited multi-threading support (with CPython) PyPI (Python Package Index) sucks. Envious glance at rubygems

经过一些思考后重写了这篇文章…

虽然我喜欢PHP,但我讨厌它的五个方面(排名不分先后):

内置函数中的命名和参数顺序不一致。 面向对象的数组方法多亏了SPL,但遗憾的是还没有字符串。 PHP本身没有真正的并发,只有通过托管web服务器的多处理 没有像JavaScript那样的异步调用 只能通过扩展进行操作码缓存。不是很糟糕,只是有点烦人。

这些是令我烦恼的语言特性(或缺乏),但更大的问题是这些与人/社区相关的东西:

事实上,很多使用PHP的人,对编程和良好实践一无所知,从而产生了非常混乱的代码。JavaScript也有同样的问题。 大量的教程/书籍传授了非常糟糕的做法和风格。这可能是第三条的主要原因。 它的坏名声主要是因为第三条和第四条。

C++

cryptic error-messages when templates are involved lack of template constraints (many cases can be worked around with template metaprogramming, but this will result in unreadable code (at least for average programmers) in most cases) pointer to member-function syntax c++ standards committee should release offical standards more often (or at least release separate updates to the standard library itself), i mean really TR1 was released 2005, and we still dont have a shared_ptr, bind and alike in the standard library. -