更好 更快 更适合笨人使用的java

Better, faster, stupider Java
At 10:14 AM on Nov 16, 2005, Ed Burnette wrote:
Lately there has been a lot of talk about "improving" the Java language. In response to C#, JSE 5 introduced generics, foreach, autoboxing, and varargs among other things to make it "easier" to program in Java. Annotations are supposedly much "cleaner" and more "powerful" than doclet comments. Now in response to C#3 there are proposals for even more changes. Will today's Java programmer even be able to read tomorrow's code?
最近很多在谈到java语言相对C#的"提高""improving" , J2SE5引入了generics, foreach, autoboxing, 和 varargs 等其他特性,使得在编程方面更“易于”编程。特别是元数据Annotations被认为比doclet 更加“干净”和“强大”. 现在,对应C#确实有更多改变了,但是今天的Java程序员还能够读懂明天的代码吗?


This has got to stop. I like the next new thing as much as anybody (probably more than most), but look, Java is not C#. Java comes from a variety of vendors, and C# comes from one. If C# changes, that vendor will create a new version of the .Net framework and push it out to everybody's machine. Java doesn't have that luxury. We still have customers running 1.4.1 and will have for at least another year because it takes a while for the JVM vendors and open source implementations to catch up.

This has got to stop这必须停止了!
我和其他人一样喜欢新的失误,但是Java不是c#
Java来自不同的提供商,而C#来自一个提供商,如果C#改变,那么只要这个提供商发布一个新的.NET框架版本即可,但是Java却不是那么轻松的,我们还有很多程序跑在1.4版本上......还有一年时间其他供应商才能赶上,开源领域的代码也才能赶上。

And why should they? Is Java great because of cool language features? Would it be more popular if you could skip a couple curly braces here or an extra cast or function call there? No, just the opposite.

New language features make Java less great. And to a lesser extent, so do new features in the core java.* and javax.* libraries. Like new methods on commonly used classes such Integer and String. Is this heresy? Probably, but I'm sure it's right.

Take the example of Mylar. Mylar is a plug-in for Eclipse and, being written from scratch, the developers decided to use all the newest features of JSE 5. One little problem, not everybody could use JSE 5. For example there is no JSE 5 support on RedHat Linux with GCJ. Oh, there probably will be someday, and maybe there are workarounds with retroweaver or something but that's not the point.

Java is great because of the huge amount of 3rd party software available for it. The majority of open source software in the world today is written in Java. It's nearly ubiquitous. But Java has to stabalize or we'll lose that advantage. It's 10 years old and it should be mature. Not dead, just mature.

Right now there's kind of a backlash against new versions of Java. For example many Eclipse plug-ins are being recoded to work in what they call a Foundation environment. This is a subset of Java which works on older versions, smaller VMs, constrained environments. While it's not as sexy as taking advantage of every new thing coming down the pike it makes the software usable in a whole lot more places than it would otherwise be.

Language guys love to tweak. I know, because I'm a language guy myself. I used to work on compilers, code generators, libraries, and debuggers. We were always adding new stuff, new commands, special keywords, etc. Did our users thank us for it? Maybe the one or two that wanted the new things, but the vast majority would just groan when a new release came out. What will this break now? Will I have to upgrade? Will I have to use somebody else's code that requires this new thing before I'm ready? Has it been ported to all the machines I need to run on? Boring, I know, but very practical and important issues.

My suggestion? Hold the line at the JSE 1.4 level or earlier. Set your IDE to not allow JSE 5 and over language or library dependencies creep in unintentionally. You still get the advantage of the run-time improvements of up-level JVMs, such as better memory allocation algorithms and better JIT code generation without changing one iota of code. If you look at all the changes in JSE 5 and beyond, ask yourself honestly, Do I really need this? Am I gaining more than I'm giving up by locking myself into that? Almost always the answer will be "no".

So when do I think it's safe to use JSE 5 level features? At the earliest, not until JSE 5 runtime support has become ubiquitous. By that I mean when it is production and supported on all platforms including the pure free/open source ones, and everbody has had a chance to deploy it and shake the bugs out and get comfortable with it. This is especially true the lower you sit on the software stack. The more people use your code, the later you should convert. It may be, you should never convert, or even go back to Foundation levels to achieve wider adoption. That's up to you.

In summary, innovate outside the language and the core libraries, in those places where the power of Java really lies. And innovate in new languages that have no existing base. Just quit making Java a moving target! Minor tweaks, I've got no problem with, but wholesale changes that try to morph Java into something quite different, I do. Accept its maturity as a good thing, as a strength that can be built upon, not as a weakness that needs to be corrected.


New language features make Java less great
新的语言特性使Java反而不怎么伟大。
Java伟大之处在于其巨大的第三方软件供应。(注意不是靠SUN公司,我注),今天这个世界上,大多数开源软件都是使用Java完成,但是java需要更稳定,否则我们会失去优势,注意是稳定,而不是死亡。

现在有很多关于新版本的抱怨,很多Eclipse plug-ins 得重新工作(我前面大骂JRE5.0对Eclipse影响可见一证)

搞语言的人总是以自我为中心,喜欢向里面填塞什么就填塞什么,但是考虑过用户感受吗....

作者给出自己的建议:
Hold the line at the JSE 1.4 level or earlier
坚持在J2SE 1.4或以前版本上。

Accept its maturity as a good thing, as a strength that can be built upon, not as a weakness that needs to be corrected.
当一个好东西成熟时再接受它....

没有评论: