Sunday November 21, 2004 | Slava Pestov Slava Pestov's Weblog - Factor, jEdit, and more |
|
I've been working with Java for 7 years and written hundreds of thousands of lines of code, and I think I can safely say I'm done with Java. I'll keep maintaining jEdit and plugins indefinately, however, I won't be writing any new (open source) projects in Java. (Commercial is another matter altogether). So here are the reasons: Static typing is limiting. For example, if you want to write a dialog box whose parent can either be a dialog or frame, you have to write this code: public GrabKeyDialog(Dialog parent)
{
super(parent);
init();
}
public GrabKeyDialog(Frame parent)
{
super(parent);
init();
}
private void init()
{
/* Actual construction here */
}
Similarly, if two classes happen to have similar methods but their designer didn't think to implement a common interface, you have to duplicate code that calls them. Arrays are broken. Why do we write Primitives -vs- values. A double-whammy when combined with static typing. There is this weird distinction between object types and primitive types -- there is no type that all values are an instance of. For example, you cannot write a method like this: public number max(number x, number y)
{
if(x > y) return x; else return y;
}
Instead, you do this -- no joke, this is straight from public static int max(int a, int b) {
return (a >= b) ? a : b;
}
public static long max(long a, long b) {
return (a >= b) ? a : b;
}
public static float max(float a, float b) {
if (a != a) return a; // a is NaN
if ((a == 0.0f) && (b == 0.0f)
&& (Float.floatToIntBits(a) == negativeZeroFloatBits)) {
return b;
}
return (a >= b) ? a : b;
}
public static double max(double a, double b) {
if (a != a) return a; // a is NaN
if ((a == 0.0d) && (b == 0.0d)
&& (Double.doubleToLongBits(a) == negativeZeroDoubleBits)) {
return b;
}
return (a >= b) ? a : b;
}
No multiple dispatch. Instead, we must use crappy hacks like the visitor pattern. Design patterns. It all amounts to this -- instead of adding expressive features to the language, the Java designers decided to focus on promoting code duplication, aka design patterns instead. Edit/compile/run cycle. Yes, I know there is hotswap and such, but it is a hack. There is no real support for incremental development in Java. No interactive top level. This is my biggest beef. Once you discover programming with a REPL, you cannot go back. ( Nov 21 2004, 11:21:31 PM EST ) Permalink Comments [10]
Trackback URL: http://jroller.com/trackback/slava/Weblog/why_i_don_t_like
Post a Comment: |
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
It's too bad you don't support open source anymore - just because of a few limitations in the programming language.
Good luck
Posted by 12.223.246.125 on November 21, 2004 at 11:53 PM EST #
Posted by Slava Pestov (24.42.111.220) on November 22, 2004 at 12:21 AM EST #
So which lanaguage do you prefer to code in right now? I'm gaining a lot of enjoyment out of ruby.
biv aka nickf
Posted by nickf (203.217.23.60) on November 22, 2004 at 08:52 AM EST
Website: http://jroller.com/page/nickf #
Posted by Romain Guy on November 22, 2004 at 04:58 PM EST
Website: http://www.progx.org #
Like you, I became frustrated with the inelegance of the Java language. After casting around for a realistic alternative, I switched to Python. I'd actually prefer Lisp, but library availability and standardization in the Lisp world are dismal.
So far, my only major complaints about Python are that it has mediocre performance and no Lisp-like macros.
It irritates me that I'm forced to descend to C and sometimes C++ for the most performance-critical sections of code. Trying to pick up someone else's open source C or C++ code base and write a Python wrapper for it or use its existing Python wrapper is often an exercise in frustration due to the well-known robustness problems with those languages. In Lisp, theoretically, I could descend to a more performance-oriented style of programming in performance-critical sections, without having to cross a language barrier.
Posted by Robert Maxler on December 01, 2004 at 02:01 AM EST #
Posted by Rex on December 07, 2004 at 04:09 PM EST
Website: http://contex.sourceforge.net/mt #
Posted by Rex on December 07, 2004 at 04:12 PM EST
Website: http://contex.sourceforge.net/mt #
Posted by k (4.16.250.14) on January 04, 2005 at 05:59 PM EST #
Please, give me a link on official sait.
Posted by Sergey Tugarinov on February 26, 2005 at 03:08 PM EST
Website: http://ruteam.ru #
Posted by S. Vuori (130.234.176.170) on March 07, 2005 at 06:51 AM EST #