?

Log in

Java Sucks. Period. - The Desian Universe
Links Home / GitHub January 2017
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
 
 
 
 
deskitty
deskitty
Des
Tue, Nov. 21st, 2006 10:00 am
Java Sucks. Period.

Grrrr. Java is a shitty, shitty language that wasn't properly thought-through by its developers. Now that I'm programming in it 8 hours a day, I'm only beginning to truly appreciate this.

I think I'm going to start keeping a list of all the mistakes in Java, so that whenever I get around to building my own language, I know what NOT to do. (Most of these apply to Java 1.4 -- anything newer is irrelevant to me, since much of our customer base doesn't have anything newer.)

  1. Java is too damn verbose. "import com.locutour.clientmanager....". "public static final ...". "new ActionListener() { public void actionPerformed(ActionEvent e) { ... } }", etc.
  2. It doesn't have lambdas. Anonymous inner classes are a poor substitute.
  3. You can't initialize the member data of anonymous inner classes using local variables. If you want to do things like that, you have to create a named inner class. (Having this feature would help mitigate #2 somewhat.)
  4. Somehow, rectangles are allowed to have negative widths/heights. I caught AWT/Swing feeding me a negative clip width the other day. (And yes, I checked to make sure it wasn't my code that was doing it.)
  5. Rectangle2D has convenient Rectangle2D.Float and Rectangle2D.Double implementations. Dimension2D has no such thing. (Why the hell not?)
  6. One would think a rectangle would be composed of a point and a width/height (or set of dimensions). Yet it is not possible to get a Point or Dimension object out of a rectangle -- you have to construct one manually from the individual coordinates.
  7. Swing is dumb about resizing things. If I want to extend/retract a widget, I must call revalidate(), which in turn repaints the whole widget. I've found no easy way to change the size of a widget without repainting everything. This is a rather annoying thing to do 15+ times per second, as it wastes a lot of CPU time.
  8. Swing is retarded about resizing things. If you have a toplevel window which is too small for its contents, rather than resize the window, Swing will just clip the bottom/right sides. So I have to guess at a reasonable starting size for a window, and hope it's big enough on all platforms in all situations.
  9. GridBagLayout is absurdly complex. GridBagLayout is also the only layout that does anything useful.
  10. Generics are not templates. This means they are both more complex ("? extends", anyone?) and less useful.


I know I've run across plenty more that I'm forgetting.

I could understand seeing most of these problems in 1.0, or maybe even up to 1.2. But how the hell did they make it all the way to 1.4?

-- Des

Tags: ,
Current Mood: annoyed annoyed

7CommentReplyShare

spooned
spooned
always the volume always the words
Tue, Nov. 21st, 2006 09:18 pm (UTC)

dear des, i have no effing clue what you said, or what any of it means, but i love reading it anyway. just thought you should know.


ReplyThread
deskitty
deskitty
Des
Wed, Nov. 22nd, 2006 05:21 pm (UTC)

Dear Spooned, I'm glad you enjoyed it. I hope you are well. Take care and have fun. Love, Des


ReplyThread Parent
elocinoco
elocinoco
Elocin Oco
Tue, Nov. 21st, 2006 09:26 pm (UTC)

I love it when you talk dirty...

*purrs*


ReplyThread
deskitty
deskitty
Des
Wed, Nov. 22nd, 2006 05:20 pm (UTC)

Well then, I guess I'll just have to do it some more now, won't I? ;)


ReplyThread Parent
elocinoco
elocinoco
Elocin Oco
Wed, Nov. 22nd, 2006 05:32 pm (UTC)

You do it sooooooo well. *giggles*


ReplyThread Parent
moment_of_me
moment_of_me
moment_of_me
Wed, Nov. 22nd, 2006 01:52 pm (UTC)

AH HA! I couldn't resist stirring this pot. You know me better than that, right??? A very good friend of Ton's, who lives currently in Australia, who has worked some with Java and likes it. I confess, I sent him the relevant text of your post. He sends this in response:

M says:

1. I actually usually like verbosity because it often adds clarity,
especially in large complex projects. IDEs make sure you don't have to
type too much.
2.I haven't used lambdas. I am guessing here that they would make
things a bit more succinct.

I have barely used Java on the front end. The other issues you raise
are tied to Swing. While this is the current standard for Java, it is
not the language itself that causes problems here. Maybe SWT is
better? Some people certainly seem to think so.

Java is not a language optimized for making GUIs. Instead, it is
generic and I like it that way.
As far as I know 1.5 and 1.6 add optional "verbosity" and take part of
the mandatory part away (mainly to do with loops and types). They did
a bunch with Swing as well, but I don't know the specifics apart from
some performance gains.
I have only used generics and clearly to my benefit on 1.5 and up. So
no comment for point 10.

If Java is shit*, what language is great?
++++

*I actually titled my email "La la la Java is SHIT". LoL. That's my fault. *le sigh* Two brainy men battling it out in an all out technical smackdown. *sits back and waits with rechargeable batteries* ;oP


ReplyThread
deskitty
deskitty
Des
Wed, Nov. 22nd, 2006 05:15 pm (UTC)

1. I actually usually like verbosity because it often adds clarity, especially in large complex projects. IDEs make sure you don't have to type too much.

That's true, up to a point. Past that point, verbosity merely adds useless or irrelevant data, which makes code harder to read. I think Java is past the point. For example, it's not uncommon for a class in my project at work to have 30+ import statements.

I find that most IDEs just get in my way. Most of code-writing is text editing, so it's better for me to have a really good editor (like Vim), perhaps with a few extra features (like macros for "build", "clean", etc.) than it is to have a full IDE with an inferior text editor.

2.I haven't used lambdas. I am guessing here that they would make things a bit more succinct.

Yes, very much so. I use a lot of listeners/event-driven concepts, not just in Swing-related parts of the project, but in other parts too. Having lambdas would greatly simplify this machinery.

I have barely used Java on the front end. The other issues you raise are tied to Swing. While this is the current standard for Java, it is not the language itself that causes problems here. Maybe SWT is better? Some people certainly seem to think so.

I haven't tried SWT, so couldn't say. (I don't know how feasible using it would be for this project, though, because I don't know how hard it is to deploy.) My main purpose in pointing out all the Swing issues I've found was to highlight the relative lack of thought that went into building Swing.

Java is not a language optimized for making GUIs. Instead, it is generic and I like it that way.

I think any good language should be generic -- which is another way of saying, "flexible enough to do whatever you want it to". I suspect a language optimized for making GUIs would annoy me rather more than Java does. ;)

If Java is shit*, what language is great?

I haven't yet seen anything resembling what I would consider a "great" language yet. I love Lisp's macro system, and I both love and loathe its syntax. (Its standard library could use some help, too.) C++ is great for doing object-oriented programming when the code needs to run as fast as possible, but its syntax is a bit baroque, and it needs better introspection/reflection facilities.

I thought of a few more things just now that are wrong with Java, but I think I'll save those and make another post about them later.


ReplyThread Parent