Sunday, June 15, 2008

[Programming] Java.

Those of you that know me have undoubtedly heard my bitching about Java. Well, I am going to try and present a un-biased comparison between Java and other languages in relation to functionality. Yes - Rodney, this will be interesting.

[*] Ease of Coding:
> The Winner: Python
Many complain that Python syntax is too lax and that 'a variable can be ANYTHING!!!'.
Well, that's a good thing.
> Why Java Sucks at This:
Java syntax is pretty C-like, and I hate the verbosity. I do prefer Java syntax over Perl's, though Perl is infinitely more useful.

[*] Speed (Execution Time):
> The Winner: C++
I don't even need a valid argument here; if you doubt me, go take your code and write a flawless C++ equivalent. Then bring me profiling results from both projects (or don't, seeing as all I'm going to do is tell you 'I told you so.').
> Why Java Sucks at This:
Unless you can natively run Java bytecode (SPARC comps), then you know that you need a JVM, a JRE, a JDK, an SDK, an IDE, a UML editor, various plugins, lots of time, a high-speed bandwith connection, and lots of patience to get a complete working Java programming environment. I'm talking about 1gb+ of downloads.
After you put up with that crap, your Java code has to compile.
Then, your binary has to call the JVM.
Right before that, the JRE has got to run a trillion checks and prompt you for updates or tell you to by SUN's crap.
Then after the JVM's glacial load time, it will decide whether it feels like interpreting your Java or not.
When it does, it will (very slowly) check your code for errors or deprecated statements.
Then, if it hasn't randomly crashed or had memory leaks or encountered some bizarre error, it will convert the Java bytecode into something your OS can work with. Then, things happen. Slowly.

It can take a noob anywhere up to 4 hours to download & install Java, write a hello world CLI app, and then compile->interpret->and execute it. May I remind you that this can be done in bash with

$ echo "#include iostream.h\n int main(void){std::cout << 'Hello World.\n';}" >> hw.cpp && gcc hw.cpp -O3 -march=native -o hw && chmod 0777 hw && ./hw
#or
$ python -c "print 'Hello World.'"
#or
$ echo 'Hello World'
#or
$ tiemu -mod=83 -BASIC=':ClrHome:DISP "HELLO WORLD."'
#or
$ echo "(printf 'Hello World.')" |xargs mred
#or
$ zenity --info --text "Hello World."
#or
$ brainfuck "++>++++++>+++++<+[>[->+<]<->++++++++++<]>>.<[-]>[-<++>]<----------------. ---------------.+++++.<+++[-<++++++++++>]<.>>+.++++++++++.<<.>>+.------------.---.<<.>>---.+++.++++++++++++++.+.<<+.[-]++++++++++"
?

[*] Least Crappy:
> The Winner: Z80 ASM
No wasted code, fast, efficent (relatively), and powerful.
> Why Java Sucks at This:
Java is full of the essence of SUK.

* I DO expect flame.

No comments: