Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Programming in Java? You must be joking! (raganwald.com)
12 points by muriithi on June 5, 2007 | hide | past | favorite | 14 comments


I confess: I could never really quite "get" Java. I always felt like it was pushed down everybody's throat by Sun on a wave of everybody's obsession with hating Microsoft. Write once, run everywhere! actually always meant run NOT on Windows. At my school they switched from Pascal to Java in less than 2 years after it came out.

But putting all this religious crap aside, and ignoring libraries for a second, I could never quite see the appeal of coding in a language of expressive power just little higher than C++ yet so severely crippled comparing to the latter. Java and Visual Basic invited ex-taxi drivers into the industry, making interviewing process very exhausting and time consuming activity. And, most importantly, Java programmers have always seemed... well... unhappy with their jobs to me. Perhaps due to Java's dominance in "boring" sector of "Enterprise wonders". ("Office Space" comes to mind)

And, by the way, when was the last time you saw "Loading C++" message on your cell phone? :-)

I guess I shouldn't have said this. I successfully managed to dodge Java ever since I graduated and that makes me a non-insider :)


_expressive power_

What is that anyway? Can you measure it in something other than line counts? I'm wary of line-counts-as-metric. It seems to be a disease of PHBs and functional programmers oddly enough.

_severely crippled_

No pointers. What else?

There was nothing innovative about Java, but the advantages had nothing to do with "expressiveness" or "power" as I understand them. The advantages were:

1. No malloc(), no free(). If you've ever done large-scale C programming, you'll spend half your time bugging around with memory.

2. Platform independence. Well, you said it. I test on Windows and deploy to linux, and the only real problem has to do with the stupid C: and slash direction on Windows.

3. Don't discount Sun's advocacy. C++ is a pain in the ass, and where you're not optimizing for CPU cycles and real-time performance (where the garbage collector is a problem) it just isn't needed. But to break its inertia something a little more real-world than Lisp macros is needed. So...corporate advocacy has its advantages.

4. Massive libraries. They blow here and there, but put stdlib.h et al to shame.

5. All-in-one. It doesn't do anything perfectly, but a large system can be done all in Java. This is convenient because you don't need fifty different tool sets, can move serialized objects around between subsystems, etc.

_making interviewing process very exhausting_

Since you've avoided Java in your career, I suspect you made that up.

Edit: Btw, since I'm bitching about downmods, I'll just add that I'm not downmodding anyone here.


I really do not want to start a war here, especially because I am not a big fan of C++. Quite the opposite. But I can answer some of your questions in case you genuinely want to hear what I have to say :-)

On expressiveness: I meant things like foreach loops, ruby blocks, python's list comprehensions, in-place on-demand functions, switch statements with strings, pattern matching, list goes on. Java is not much ahead of C++ in that regard. Not a real upgrade.

BTW garbage collection is not really a "feature" of the language. And no, these days people (quality C++ folks) do not spend any time debugging memory leaks. World has changed since early Unix days: smart containers, smart pointers and automatic unit tests largely eliminated memory leaks issues. I honestly do not remember when was the last time I used new() or alloc().

About being crippled compared to C++: do not even get me started. Lack of templates (until relatively recently and they're still not a real thing), lack of multiple inheritance nor mix-ins to replace them, no true functions of any kind, no choice of memory allocation: heap vs stack, this silly "everything is an object" idiom...

Again, quality libraries is something I asked to ignore, because it is really not a part of the language. And you are absolutely right here: Java folks have been enjoying the available pool of tools: an order of magnitude bigger than C/C++ guys ever had.

And, finally, on platform independence. Java does not run on Windows or Linux. It runs on one platform: JVM, which is conceptually is no different from C++ plus some kind of OS abstration layer, similar to what Mozilla/Apache teams have. Basic idea is always the same: language + runtime. Call it JVM or Library or VMWare host. Yes, I can always develop for Linux and run it under a virtual machine on any host OS, This solution arguably even better than "language VM", since you're taking everything you need to run from one host OS to another.


I feel the "platform independence" makes a huge difference, though. I develop on a windows machine, and I can just deploy the binaries on the Linux-Server. I don't have any version headaches for deploying on various platforms. Maybe that is just a small thing and no big deal for make-wizards, but for me it is enough to avoid other settings like the plague. I ran into problems like that when I tried Ruby, btw. It seems there are different versions for Windows which are not compatible with each other (ie Cygwin version or Visual C++ version).


Expressive power corresponds to shortness of programs, but LOC is not the best measure of that. Roughly, expressive power is 1 over the size of the parse tree.


I find it entertaining that even pg's most mundane posts get upmoddage like no other. I assume this is why he took himself off the "leaders" listing.


When he went on vacation and stopped posting for a week, the site seemed to slow down. So, obviously, people know what they're doing when they mod up. :)


Expressive power is a few things.

Either:

- Pointers

OR

- Garbage-collected reference-counted objects

Plus

- Closures (incredibly important to have these)

Plus

- Compile-time macros

Plus

- Recursion

Shawn


Before Java, I had programmed in C, C++ and Perl. It was amazing that with Java things just worked the way I expected them to work.

Whenever I try to learn a language like Python or Ruby, I find myself chasing bugs for hours that I could never even have made with Java. Nevertheless, maybe the time has come to work with another language. But Java is not bad.

Edit: oddly, I don't remember this chasing of bugs with Scheme, even though it also is not statically typed. Hm... (I liked Scheme).


Java's crippled? I'm curious what you think that entails.

As far as I'm concerned, every mistake made in C++ with regard to object oriented programming was fixed in Java. Also, as recent benchmarking has shown, Java's speed is fine. If OS's were written in Java, you wouldn't even notice the runtime load period.


For what it's worth, IDE's make java far less painful in a way an IDE could never help a dynamically typed language.

I used mostly python or other scripting languages before taking a primarily java-based job. At first I was fearful, but then I got a taste of what an IDE can do to Java.

Sure you have lots of libraries to call, and lots of mundane code to write, but the IDE is able to a) give you your options and b) autowrite the mundane code c) catch most errors before you compile thanks to tight syntax and (almost) strong typing

It can also save a lot of time over python which is prone to introduce program halting errors without any compile time notification. This is especially annoying if you have programs with a long runtime.

In the end, its just another tool in the bag.


Same experience here. The power of Java is more apparent in larger projects where the rigid policies (ex: no multiple inheritance) and strong typing maintain a high quality standard for code and minimize those nasty deeply seated bugs.

For hackers writing short programs quickly it seems like a pain but this rigidity pays off as things scale. Great IDE implementations (eclipse) really shine when they can utilize strong typing to warn of syntax, compile-time (and some logical) code faults while coding. In my experience catching these problems in the IDE yields a greater time savings in the long run (vs interpreted languages)..


_You know, this kind of joke seems to rile Java apologists to no end_

I've really never known a Java programmer to be riled by any joke. I've never known any Java "apologists" at all, though they probably exist. Oh, well. That just highlights one of the good things about using Java or Windows: You are generally _not_ an unreasoning fanatic. Try criticizing ANY OBSCURE LANGUAGE...THEN you will rile people:

http://programming.reddit.com/info/1vo0v/comments/c1volq

Look at those downmods. I point out something perfectly true (ie, that unpopular language fans typically overrepresent the importance of minutiae) and get downmodded into oblivion.





Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: