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

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


当前回答

我知道我迟到了,但恨是永恒的!

Java

Runtime.exec(). So, if I don't manually clear the STDOUT and STDERR buffers, my code will hang? Wow. Die, plz. Null Pointer Exceptions. Responsible programming means I have to treat most objects like they're unexploded bombs, which is kind of a pisser in an object-oriented language. And when the inevitable happens I kinda need to know which object blew up in my face, but Java apparently feels telling me would be cheating. File I/O. Why do I have to jump through this many hoops to read a dang text file? And when copying files, I have to funnel the source file into my code and manually handle the output byte buffer? You're serious? Primitives vs. Primitive Wrappers. Note that Java now has a number of features that allow you to treat primitives and their wrapper objects as interchangeable in some places, but not in others; don't worry, the compiler will let you know which is which. This feels like a hack to work around a fundamentally broketastic design decision. And it is. (EDIT: Actually, the compiler is a much crappier safety net than I thought, particular when doing equality checks. If `a` and `b` are integers, `a == b` is guaranteed to behave as expected only if at least one of them is of type `int`. If they're both type `Integer`, then that statement will do what you think only if the two numbers are between -128 and 127. `Integer a = 1000; Integer b = 1000; return a == b;` will return `false`. Really.) XML. I have this dirt-simple little XML file I need to create and I have to do what?

其他回答

Python:

没有分隔符表示块的结束会导致歧义,这样自动缩进就不能处理格式不佳的代码。 没有宏(修饰符不算) 没有像haskell的cabal或perl的CPAN那样的库自动获取 不能声明变量const(是的,可以自己定义变量,但是…) 元编程被削弱 差点忘了全局解释器锁

我对特尔斐的5分:

Procedures and functions aren't necessarily distinguished from variables if not parameterized (eg, I can have statement such as x := GetPositionOnScreen; instead of x := GetPositionOnScreen();) Try/Finally and Try/Except needs to be nested (stated once before, but it's still one of mine as well). Not case sensitive. Can have a multiple objects (functions, global variables, local variables) named the same and Delphi will happily try to figure out what you mean. names should be unique. Odd if condition rules. a single conditional check doesn't require a () around it, but if I do multiple checks, I need a () around each one, and sometimes multiple nested sets for bigger checks. No inherited includes. If I need to reference functionality from the Windows unit in a base and an inherited form, I have to include Windows in both.

VB。网

默认情况下弱类型(Option Strict修复了这个问题,但默认情况下没有启用) 在方法上不需要括号(myFunction而不是myFunction()等等) 是否使用括号来定义数组/使用(myArray(12)而不是myArray[12]) 不支持直接递增(i++) 是否支持遗留的On Error关键字和整个VB6-Namespace

德尔菲:

IDE有点不稳定。 代码洞察有时令人困惑。 调试有时是有bug的。 更新多个项目文件可能会很麻烦。 如果启动时一个或多个包不可用,错误消息会弹出几次。

C++

模板的语法 钻石传承问题 现代语言所拥有的标准库过多/缺乏(尽管boost也很接近)。 iostream IOStreams周围使用的语法

Python

空格是有意义的(有时) 强调关键词 有限的线程支持(至少目前) 用self代替this 空格是有意义的(有时)