[vox] Who thinks Java is cool?

Bill Broadley bill at broadley.org
Wed Jun 15 20:49:37 PDT 2011


On 06/13/2011 06:58 PM, Brian Lavender wrote:
> I used to hate Java, but now I think it's cool.

Been busy, but I couldn't represent throwing out a few (er, well it
started that way) thoughts.

Back when I was writing tons of C, a fair bit of perl, and a bit of C++
(and dealing with templates and rather poor compatibility) java seemed
like a breath of fresh air.  I took one of the first Java courses
offered just a week or so behind the public announcement of Java.

Of course people back then believed the Java claim of "Write once, run
anywhere"... which quickly turned into "Write once, test everywhere".  I
did a few projects in it, but seemed kinda limited.  No operator
overloading, plagued for years by very poor JVMs, memory leaks,
stability issues, a fairly crippled functionality, poor threads, and
crippled FP.  I mean really, no stat()?  No decent GUI framework (they
ditched what 3 generations before getting stable?)  Of course no good
open source solutions for what a decade?

Seems like it took 5 years before there was a stable java, and by then
it seemed like 99% of Java was web frameworks (tomcat and the like) and
middleware.  Not to surprising since you can't really talk to a
filesystem, or have particularly nice GUI framework.  The pain of
programming anything GUI like was impressive.

So for large projects that talked to web
clients/servers/middleware/databases it was reasonable... once the JVMs
improved.  I preferred it over Perl of course, and C++.  C vs Java for
me mainly came down to performance expectations, available libraries to
help out, and how friendly the task was to an object oriented approach.
 Garbage collection took a good while to mature, I often wished for
explicit calls to avoid garbage collection issues, some hacks helped,
but it was for a long time worse than not having GC.  In few case some
data strucutres I wrote would leak on IBM's Java, but not Sun's.  Others
would leak on Sun's and not IBM's.  Still others leaked on, er, umm,
maybe it was Forte or something?  Seemed like every program has a
preferred JVM.  I did some gaming with network game called Europa, my
stats were great because I knew which JVM was stable enough to complete
a 10 minute game.

Python started before Java (at least the public release) but started
grew slowly at first.  Definitely more fun then any other language I've
tried.  More readable/writeable than Perl, a fairly complete set of
libraries, stable, easy to debug, easy to tinker with.  Somewhat of a
polar opposite to C++.  Nice clear syntax, and nice clean support to
achieve most goals unlike C++ which seem to support all possible
approaches to most goals.   C++ isn't too bad with a single developer,
keeping a team using the same subset of C++ so they play well together
can be painful.  C++ seems like a multitool with 100 functions, but most
programmers either use an incompatible subset, or they use more features
of the language than they can be truely proficient with.  I really
really hate having to run c++ code through cpp to see something close to
what actually is causing the problem.  The horrid namespace demangling
for debugging was truly evil for many many years.  Seems like ever C++
compiler with every release mentions improvements in exceptions, error
handling, and related features.

Python has very nice combination of easy to use, powerful, yet
structured enough so non-trivial sized programs don't turn into a mess.
 I'm not a big fan of the lack of types, but that's not a major issue
for me.  I like how the language is growing, still well designed, and
willing to depreciate the old approach and keeping thing coherent and
well designed.  While the GIL is gross, python seems relatively unique
in providing multiprocess safe pipes and queues as part of the language
standard.  Suddenly having 1-N producers and 1-M consumers safely
communicating to keep that fancy multicore phone/tablet/laptop/server is
rather straight forward.

I find it particularly useful to be able to tinker with live programs,
start up python, load the relevant classes, and you can create, call,
time, display, print, debug, create/destory objects.  Being able to
tinker with a live program without having a crippled debugger (most
don't understand the language you are using) is quite handy.  Pike did a
video series introducing Go that is pretty good.

Oh, for anyone interested in learning python google has a cool 2 day
class that has 7 lectures, laps, and is rather well done.  You'll
definitely have a good grasp of the basics by the end if you have any
familiarity with any programming language.  Hopefully folks can figure
out how to find said online class.

I've recently been tinkering with Go.  It's strongly typed (which I
like), has a nice clear syntax, and is available compiled or
interpreted.  It seems to be the most multi-processing friendly language
I've tried.  I wrote a multithreaded mandlebrot solver that was the
fastest go implementation for the debian alioth benchmark last I
checked.  It was shockingly easy (a single sitting) to write a producer
of chunks, asynchronously talk to N clients that got variable sized
chunks of work and talk to a single consumer to take the out of order
chunks of finished work and write them in order to a file.
Disappointingly my first implementation while elegant, was a bit
overkill for the example program provided with not much I/O and a fair
bit of work per pixel.  No points for more efficient I/O, higher
parallelism, or less sensitivity to highly variable CPU per chunk.

I kind of think of Go as a second generation C designed to be more OO
and multicore friendly.  I particular I'm really fond of channels.

I do wonder if Oracle will be successful in forcing google off of Java,
despite the fact that android phones don't run java.  If I had to guess
if forced they would switch to go for app development.






More information about the vox mailing list