最近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.

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


当前回答

Python

错误/异常在调试时是模糊的 我工作时不用 在类中使用__init__, __repr__, __str__等 不能简单地编译可执行文件(.exe或其他) 还有一件事我还没试过,但肯定会让我心烦

对于所有的c语言程序员来说,self对我来说更有意义,因为对象引用的是它的self

其他回答

Python:

1) It's a scripting language and not a fully compiled one (I'd prefer to be able to compile binaries—I don't care about bytecode). This is very annoying if I have to use very many libraries (i.e. everyone who uses my program has to install all the libraries, and this basically means no normal people will be able to, or have the patience to, properly set it up—unless I do a ton of work that should be unnecessary). I know ways to make binaries, but they don't always work, and I'm guessing they bundle the interpreter in the binaries anyhow (and I don't want that). Now, if I could get a bytecode compiler that would include copies of all the files that I imported (and only those) to be placed in my program's folder, that might be a suitable compromise (then no one would have to download extra libraries and such). It would also be nice if the compiled python files could be compressed into a single file with one specified as the file to run the program before this is done.

2)有时看起来有点bug;有几次,应该工作的代码根本没有工作(没有程序员错误),特别是与“from moduleX import *”和其他导入相关的问题有关的代码,以及一些与全局和局部变量有关的问题。

3)最大递归深度可以更高。至少有一次,我觉得我需要它去更高的地方。

4)没有switch语句(更不用说允许数字、字符串和范围的语句)

5)新版本的Python似乎取消了很多有用的字符串操作,而且似乎没有简单的文档说明如何在没有它们的情况下做同样的事情。

6)强制自动垃圾收集(我希望能够手动执行,尽管不一定强制执行)。

7)没有预先制作的定时器类没有使用GUI(好吧,可能有一个,但在我所做的所有搜索之后,它肯定不方便找到!我确实找到了一些东西,但当我尝试时,它根本不起作用。)所谓计时器,我指的是每隔x秒执行一个指定函数的排序,并能在需要时关闭它,等等。

8)社区里举例的人很少告诉我们他们导入了哪些模块,以及他们是如何导入的。

9)与Lua集成的支持并不多。

10)似乎没有办法向一个类的特定实例(而不是整个类)添加一个额外的函数,除非你动态地向该类添加一个对象变量,该对象具有所需的函数(但仍然,你必须为此创建另一个类)。

PHP:

1)强迫我创造不必要的变量:

$parts = explode('|', $string);
$first = $parts[0];

2) lambdas的实现如此蹩脚,它大致相当于使用eval(),而且如此糟糕,我从未使用过它(参见http://www.php.net/create_function)。

3) try/catch系统只能捕获大约80%可能发生的错误。

4) Regex支持和lambda支持一样蹩脚,因为它必须在常规字符串中编写,这使得最难学的编程工具之一变得困难了三倍。PHP应该是一种“简单”的语言吗?

5)没有办法安全地从$_POST中取出东西,而不写两次或构建自己的函数,或使用'@'操作符:

$x = isset($_POST['foo']['bar']) ? $_POST['foo']['bar'] : null;

6)额外答案:“@”。如果你懒得写正确的代码,那就添加'@',这对以后调试你的代码的人来说太糟糕了。

Perl代表了一种可怕的语言。

No "public" or "private" or "protected" declarations/definitions. The "my $variable_name;" does not declare a global outside of a subroutine. The "my $variable_name;" gets accessed by subroutines but "use strict;" or other "use " creates warnings. Function prototypes end up unexplained, undemonstrated, unwanted, or some other excuse. Overzealous symbol use ends up "cool and quick" when reading globs of symbols. When one gets hot they like to stay hot, and need nothing to cool them. After a week of Perl, I end up unable to write a function and prototype it. What exactly is a module and does it actually NEED a ".pm" extension? If you want to create a public variable and access it from inside a subroutine, how do you accomplish this without creating a warning? Where do you find some neat scripts that teach one some neat Perl?

c#(好吧,我猜一部分是VisualStudio IDE):

No covariance (yet), like Class<D> cannot be used in place of Class<B> even though type D derives from type B. Graphic designers don't support generic based inheritance (or inheritance from abstract classes), even though the inheritance itself works just fine if you work around the designer problems by adding extra inheritance levels just so designers always see concrete non-generic variants of your code. No constructor inheritance No constructors in where clauses of generic type parameters VisualStudio seems to have a tendency to mysteriously check out files (like project files and/or unit test definitions) when opening a solution, even though the files do not seem to actually get altered.

如果你明天再问我,可能会有不同的名单。即使协方差和设计师的麻烦将在我的前5名,直到他们被解决(随着方差添加到c# 4.0,这似乎已经发生了至少一个…)

Python

1-3:没有一个明显的打包/构建/文档系统的选择(比如Perl的cpan、POD或Ruby的gem、rake、rdoc)。 4: Python 3.0是不兼容的,需要两个源分支(2。x和3.x)用于每个Python项目。但是Python 3.0的不兼容性还不足以证明它的合理性。大多数py3k的优势都太微妙了。 5: Jython, IronPython, CPython不兼容。