I've been taking a design patterns class at Portland State this term. I've been really enjoying and getting a lot out of the material of the class. However, the class is entirely in Java, and each time I sit down to do an assignment, I find myself wonder how people can actually use this steaming pile of a language. Seriously. Let me cite an example of why this language is just worthless.

I have a class hierarchy for expressions in a programming language. This consists of a base class (Expr), derived classes for different types of operations (ExprMul, ExprAdd, etc.), a derived class for variable dereferences (ExprVar), and a derived class for literal constants (ExprIntLiteral).

I want to use implement the last two as flyweights. I add a class ExprFactory to manage the instances of the flyweights. I also make the constructors of the flyweights private. This is where the whole thing falls apart. Now that the flyweights' constructors are private, I have to put all of the classes into a package.

Now that all of the classes are in the same package, they all have visibility into all of the other classes. WTF?!? I wanted to limit the visibility of a couple methods in a couple of classes, but in order to do that I've had to remove all visibility limitations on everything. Fueled by bong hits.

I've also noticed that it's almost impossible to do Java development without using an integrated environment. It appears that once you start using packages, you have to build things in a very precise order. I basically have to fiddle with it until the compiler stops giving me useless messages.

And don't get me started about having to put every public class in a separate file with a matching name. Seriously?

Java is a toy language for making web applets. It is completely useless for anything else.

UPDATE: I have now learned the difference between marking a method or member explicitly private and leaving it blank. But I'm still irritated.

comment 1
I don't understand your irritation: you are an experienced developer, why taking conclusions (Java is a toy) at the first trouble? Java succeeded in being a small and clean statically typed and type safe language: I think it was actually one of the first languages that forced people to think in patterns, rather than discover them late (for example, a directory hierarchy reflecting the "package" hierarchy will be honored while compiling sources: this is a perfect example of respecting "Convention over Configuration" paradigm). java is not perfect: it seems you discovered "package" visibility; it's not the solution to all evils but it works if you follow Java compatible patterns, and it's much simpler and maintainable than c++ friendship. Java doesn't force you you to use an IDE or have a build framework: I always succeeded in manually compiling java sources after correctly setting the classpath variable and the files in a correct directory hiearchy (reflecting "package" one, as said). Sure, any java developer recommends you to use an IDE and a build framework: in C development using an IDE is up your choice but a build framework is a must for any serious project; using an IDE will give the bonus of online error checking (this the good of being statically typed and type safe), refactoring operations and other useful functions that may be not quickly obtainable using a generic editor. java is limited regarding advanced programming techniques: no things like multiple inheritance, no latent typing (=no c++ like templates). java is an old language and before or late it will be replaced (c# would be a good candidate, but try to look at it if you want an example of how to bloat a programming language with a plethora of reserved keywords for every single problem). Java java is all this and other things, but it's definitely not a toy and is definitely not used only for web applets (I think this affirmation is so wrong that actually web applets is the field where java performs worse, IMO. In fact the web now is Flash and Silverlight, maybe HTML5 in the future).
Comment by Francesco Pretto Mon 01 Mar 2010 02:54:45 AM PST
RE: comment 1

This isn't my first trouble with Java. It was the trouble that finally irritated me enough to openly whine about it. :)

I guess the problem that I have with both Java and C++ is that both languages try way, way too hard to keep you from hurting yourself. In the process, they make some really straightforward things just excruciating. I know what I'm doing. I know how to do it safely. Either help or get the hell out of my way. I know I'm not the only developer who feels this way. I keep thinking that one of these days I'll try to write a frontend to LLVM that implements just enough of the useful bits (implemented in non-broken ways) of C++ to be compelling. I'll try to avoid a C++ rant for now.

Also keep in mind that I was frustrated and venting.

Comment by IanRomanick Mon 01 Mar 2010 01:35:07 PM PST
comment 3
That's so stupid to cry over a language you just started xD Maybe you should wait a bit! If you don't like C++ and Java, maybe you should also tell you don't like object oriented programming ? Things like Eiffel would kill a dirty guy like you :D
Comment by Anonymous Thu 08 Jul 2010 03:05:08 AM PDT
RE: comment 3
That's the thing. I do like (most of) C++, and I like Python. As far as OOP goes, it's a tool that has a lot of uses, but it's not the solution for every problem. In Java, it's the only solution you're allowed to use. This old post from Stevey's Blog Rants sums it up nicely. Not only is Java excessively nerfed, it artificially ties one hand behind your back. Fail.
Comment by IanRomanick Thu 08 Jul 2010 10:15:34 AM PDT