Wednesday, July 9, 2008

Java (arguably an exception to the 'mostly')

There's a reasonable chance that I'll end up writing some amount of Java for LocaModa. I was a little nervous about this at first because it doesn't exactly have a sterling reputation, at least in the circles I run in. Q likes it, though, and Mas seems to think it's at least ok, so I decided to go inspect the documentation. Mas pointed me towards the docs on Sun's site, which initially scared me quite a bit. Navigating intuitively from their home page, it appeared as though learning Java would cost $760. Googling on "sun java docs", I was able to find the free tutorial. () I decided to read the section "How Will Java Technology Change My Life?", primarily because reading analogous things in their respective documentation made me think that Perl and Ruby were pretty cool and that Python had a bit of a chip on its shoulder. (Learning Python was very focused on the 'advantages' of Python over Perl)

The sell here is very clearly targeting people who are coming from C, or a level of developer hell similar to C++, probably the beast itself.

Point-by-point:

*Java's start-up time is massive compared to that of Perl, Python, Ruby or Scheme. It is, at best, as speedy to get installed and write 'Hello, World!' as C, but that's assuming a lot. (that the developer is not using an OS with a C compiler already installed and fails to consult wikipedia)

*Java code is bloated. It may well be 4x as concise as C++, but it is massive compared to any of the above non-C languages and for some cases appears to be more verbose than C. The Java 'Hello, World!' is at least as long in terms of lines and has many more things for the novice to understand. While this is not strictly verbosity, it has the same mind-cluttering effect.

*Garbage collection is not exactly teh uniquely Java tech, and I have a difficult time believing that a language that verbose and structured is useful for learning good programming practices. I learned good programming practices by writing bad code. (long Perl scripts with no subroutines) I don't think that doing something correctly from the start gives you a proper understanding of why a particular method is correct: you need to screw up in order to know why the wrong way is wrong.

The alternative is to just accept the argument-from-authority, which is fundamentally opposed to the hacker ethos.

*Development time in Java is probably faster than it is in C++. It appears to be radically slower than Ruby dev time, at least for web apps.

*Platform dependencies: this is literally just a library issue. Library strength is a somewhat dubious selling point, because it just takes time and effort to catch up. At some point, Ruby (largely) caught and passed Perl and Python in terms of library strength.

*Write once, run anywhere: this is probably actually moderately nice for some cases, and is much less informationally selective than basically all of the previous arguments.

*Ease of distribution: no real opinion on this, probably true, probably a good thing.

The best argument for using Java is almost certainly that it is currently an industry standard. This is a pretty dubious means of selection because it requires you to believe in the durability of the status quo and individual programmers have proven somewhat disruptive of that.

Imagine telling a PHP programmer 4 years ago that they would lose web dominance. Or telling a COBOL or FORTRAN programmer in their hey-day that their languages would become moderately obscure punch-lines.

This argument is not fundamentally new, but it probably saved me from hemorrhoids or an aneurism.

No comments: