Felix Rambles

Another step to taking back control

Ramblings about Java

12 September 2018 — Felix Pleşoianu

So, the other day me and a bunch of other people were discussing programming languages on Discord. We happen to have a very knowledgeable person in that group, who pointed us at an epic rant they wrote some three years ago (it seems) on why Java is bad for you. Having some experience with the language myself, that resonated with me.

One place where I disagree with Mr. Mallett: the thought of prototyping software in Java is terrifying to me. Spending hours thinking how to formulate something in hundreds of lines of code just to throw it out? In Python, I spend that time thinking what to formulate, exactly. The code is often a one-liner. No, seriously. Java, with its endless chains of public static void eeny meeny miny moe... is anthithetical to experimentation.

Also, is it a surprise that Java is slower than C++? It's running in a virtual machine, FFS! Sure, it uses JIT compilation to make native code... for parts of your program... after noticing certain patterns. It works great for specific things, such as running the same script repeatedly in a simple interpreter. But take it out of its comfort zone, and you might just as well code in Lua. The same thing happens with Javascript, which can rival native code in highly contrived applications written by the same people who made the VM and compiler. Gee, thanks. And yes, I was naive too once.

Moving on, if you think Java programmers are ignorant, try PHP programmers. I once had to teach a former colleague that when a script keeps running out of memory, it just might be from too many database queries with not a call to mysql_free_result. Surprise, dear young programmers! Your computers do not, in fact, have unlimited resources, and the garbage collector can't take care of everything. And speaking of PHP, that's another terrible language for beginners, because while it's easy to pick up it also teaches you nothing about the hardware that will struggle to run your code, while encouraging terrible coding practices, regarding security in particular.

Oh by the way: I'm pretty sure interfaces in Java were meant to enforce type discipline. Like Pascal before it, it's a language designed to protect people from themselves by leaving them handcuffed in the path of a flash flood. Which is exactly why teachers love it: many teachers, you see, think their students are mentally challenged subhumans who can't possibly be allowed to do their own thing.

Except, of course, in Java you can easily just declare everything as an Object and make the language dynamically typed in essence.

I'd better stop before this gets too long. Go read the original rant.

Tags: programming, education

Comments? Tweet