Java, even worse than PHP!

I’m taking a course in object orientated programming (OOP) at university. I always hated OOP, it seemed like an overly difficult way to doing the stuff I wanted. Now, the course I’m taking is in Java, an old language. It’s even worse than PHP. It’s extremely verbose and lacks even basic high-level functions.

There is perhaps no simpler way to show this than to compare Hello World programs:


public class javaprogram {
    public static void main(String[] arg) 
        System.out.println("Java sucks");

I’ve highlighted the extreme verbose print command. Compare with the normal print() or echo() in PHP.


print("R is good!");

Luckily, one can be tricky and simply begin writing abbreviated functions for these and then load them every time one willingly uses is forced to use Java. E.g.:

//reduce desire to an hero
public static void print(Object string) {

And so on. One could basically import all the common functions from say Python/R and make some of the Java go away. :)

Number sequences

Another example. I wanted to stop using for loops because Java’s are overly verbose and annoying. So I think, no problem, I’ll just switch to the generally smarter foreach loop. All I need is a integer sequence function. In R, this is easy, just “1:5” will generate a list with (1,2,3,4,5). Python has range(5) which gives (0,1,2,3,4). Surely there is a built-in function for such an obvious function right? Right? From Googling it, it appears not.

One good thing

Reading the book has made me understand the kind of things OOP can be good for, making games where the inheritance stuff is very useful.