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