This was a response to Ian’s Progluminators journal entry, which is a spirited defense of the decision to use Java for Freenet and is mostly directed at the people who keep suggesting a rewrite in C++. Rewrite yes, C++ no.

I don’t particularly have a problem with using Java, just with using Java where it’s not appropriate. If you need to write something that has good and predictable performance, Java is the wrong choice – not because it’s interpreted, that’s a myth in the modern world of JIT compilers, but because of its voracious appetite for memory and its thoroughly non-deterministic garbage collection (an implementation artifact, but apparently a universal one). If your code might ever go into the kernel, or has to interface closely with something in the kernel, or even has to interface closely with some preexisting bit of native code in user space (we don’t all spend our lives reinventing the wheel), Java is the wrong choice. I’ve been on projects where we had to deal with a big glob of Java interfacing with another big glob that had to be native code, and it’s very ugly. No, JNI doesn’t cut it. If none of these concerns apply to your project, then go ahead and use Java. For that matter, in those environments you could just as well use Python or LISP or any of the functional languages and get even more of what Java (the language, not the library collection) claims to offer. There’s a criticism of C++ that IMO might also apply to Java: for everything it does, and for every potential use, there’s something else that’s even better.

Not that I’m a C++ fan. I tend to do most of my work in C because I have to, and when I don’t have to I jump up to Python (which interfaces with my C code much better than Java does, and doesn’t have a visible compilation step). There’s certainly a lot of ugliness in C++ but I can live with that. What drives me absolutely bonkers is the way people use C++. Almost every full-time C++ programmer seems to feel this bizarre compulsion to use every single feature all the time. Everything has to be a template, everything has to be overloaded, everything has to use “functors” and singleton idioms lifted out of some design-patterns book without a jot of understanding. I can deal with arbitrarily complex idioms and styles and APIs when I need to (there are some pretty hellish APIs in any OS kernel, of necessity) but I don’t appreciate it when code is obfuscated just for the sake of showing off what a C++ guru the author thinks he is. STL, which is to a large degree the source of this madness, has rotted a whole generation of programmers’ brains. The first several times I saw this phenomenon I just thought that particular programmer was a dork. I’ve seen it enough times now, though, that I think there must be something inherent in the language that activates the dork gene. The people who resist the temptation to write awful C++ code are the exception, not the rule. I’d gladly hire people with such strength of character…to work in some other language. For all of the problems I just mentioned with Java, I’d rather deal with that than with the garbage that most C++ programmers spew into a project.