Live data from Hacker News

"Should I still learn Java?" Answered: Yes.

beginwithjava.blogspot.com

101–108 of 108 posts

Re: "Should I still learn Java?" Answered: Yes.

#101
post #92
post #75

Earlier quoted context omitted.

- Strong push towards threading. Before NIO, there wasn't a way to avoid threads if you wanted to talk to multiple sockets. NIO has solved that for networks, but the whole java framework/idioms push you towards threads where it shouldn't. - No way to tell how things are implemented. I had written a heapsort in Java. It run x40 slower than the equivalent C. I was trying to figure out why -- e.g. was it inlining the th…

> Strong push towards threading. Before NIO, there wasn't a way to avoid threads if you wanted to talk to multiple sockets. NIO has solved that for networks, but the whole java framework/idioms push you towards threads where it shouldn't. Where? I'm starting to think people dislike Java for the community / way it's used in enterprise rather than anything to do with the language. There's no push toward threading in th…

>> Strong push towards threading. Before NIO, there wasn't a way to avoid threads if you wanted to talk to multiple sockets. NIO has solved that for networks, but the whole java framework/idioms push you towards threads where it shouldn't.

> Where? I'm starting to think people dislike Java for the community / way it's used in enterprise rather than anything to do with the language. There's no push toward threading in the language :/ And NIO has been around for years.

I've used Java (and was burnt by it) before NIO made its appearance -- it was 2002 or maybe even 2003. I recently had to join a Java project that's "only" been around 2 years, so it could have benefited from the years of NIO -- but other than the base language, there is no async interface to be found. You want to talk to a database or key value store? You have to block (meaning thread). Want to do a URL fetch? you have to block, because there is no non-blocking libraries to be found.

It's not that it is impossible to do -- it is quite possible -- but it is almost against java culture.

> Where? I'm starting to think people dislike Java for the community / way it's used in enterprise rather than anything to do with the language.

You can say that again!

The java language is, I guess, ok (I don't like it, but it's mostly a matter of taste). The java ecosystem encourages verbosity-for-verbosity's sake, engineering-for-engineering sake, and ignoring common sense in the name of "purity".

That Java project I joined, for example, has hundreds of classes that do nothing but store a field or two, have getters and setters for them, and perhaps have one "action" in them. Each such class is only a couple of hundred lines. This is totally useless, and when optimization time comes (and it comes, because the project is running too slow because of hundreds of layers of encapsulation), it is nearly impossible to find a culprit because everything is spread thin through hundreds of useless classes.

I put up a plea for good java code on HN a few days ago: http://news.ycombinator.com/item?id=2094274 it didn't get high enough to ellicit much response (20 on the "ask hn" page, not sure how far on the main). But the responses that are there did not cause me to re-evaluate.

> - No way to tell how things are implemented. What?? Look at the source code. Decompile the class file into byte code :/

I have a merge sort that takes 40x long as it does in C. The reason I needed to implement it myself is that for the 400MB of data I'm looking it, the library tried to allocate over 2GB (which is all the deployment machine has), and that's just my test data -- when I try to sort 2GB of data, it would have required ~10GB.

I carefully wrote it so that no object gets allocated during the sort. 40x slower than C. WTF? Perhaps that MemoryMappedByteBuffer I am using does not inline it's ".get()" method -- that would explain x5, I think, not x40. But I have no frigging way of checking.

I am doing high performance code, which I agree is not common, but my experience with Hadoop (which is becoming ever more popular) is that the design decisions are such that the performance cost is x10 for just using hadoop compared to writing straightforward code -- meaning you would need 10 nodes to just break even.

I've been burnt by Java. I came back only after I could treat it with an open mind. I've been burnt again. I hate Java.

Re: "Should I still learn Java?" Answered: Yes.

#102
post #91
post #89

Earlier quoted context omitted.

Is it common for java developers to use a "dumb" editor like textmate / jedit / nano? I've heard that a good IDE is a requirement for writing significant amounts of Java. To be fair, I've mostly been interested in Scala; but it seems like you have to know Java to get the most out of Scala.

It's a myth. People who don't like Java moan on that it's so verbose and the only way to get anything done is by using an IDE. Do people use IDE's to write assembly language? I'd say majority do not. You just learn to organize your code well and to be concise and tidy. A good skill to learn. My current project (Mibbit), is about 25k loc, in around 200 files. I've never had any issue working with it. I think the diffe…

> I think the difference lies in if you write 'Enterprise' java, use XML for everything, use patterns, tons of threads etc or if you just write tight, tidy, concise speedy java.

There's a saying, "one of the problems that lawyers have, is that 95% of those in the profession give all the rest a bad name". That's also true for people who view Java.

notch's screencasts show that there is an alternative, and I'll take your word for it that you're in that class as well. But you're part of the 5%; maybe the 1%.

Re: "Should I still learn Java?" Answered: Yes.

#103
post #77

Earlier quoted context omitted.

It says something when Ruby's notoriously shonky documentation is the paragon in an example like this. The comparison with, say Python, is even more illuminating.

I might be wrong, but in the case of String, not really: http://docs.python.org/release/2.5.2/lib/string-methods.html

There's also http://docs.python.org/tutorial/introduction.html#strings, http://docs.python.org/library/string.html and http://docs.python.org/library/stdtypes.html#sequence-types-.... There's a fair bit of duplication in there, yes, but I think it's a pretty good coverage overall.

There are some absolute doozies in the Ruby documentation, particularly around IO and the Socket hierarchy. String is relatively ok.

Re: "Should I still learn Java?" Answered: Yes.

#104
post #92

Earlier quoted context omitted.

> Strong push towards threading. Before NIO, there wasn't a way to avoid threads if you wanted to talk to multiple sockets. NIO has solved that for networks, but the whole java framework/idioms push you towards threads where it shouldn't. Where? I'm starting to think people dislike Java for the community / way it's used in enterprise rather than anything to do with the language. There's no push toward threading in th…

>> Strong push towards threading. Before NIO, there wasn't a way to avoid threads if you wanted to talk to multiple sockets. NIO has solved that for networks, but the whole java framework/idioms push you towards threads where it shouldn't. > Where? I'm starting to think people dislike Java for the community / way it's used in enterprise rather than anything to do with the language. There's no push toward threading in…

I agree with your rant and am grateful for every day I don't have to program in Java.

Also, I just noticed your username... are you the same beagle3 as on Reddit? If so, I like your comments, particularly the ones about APL/K/J.

Re: "Should I still learn Java?" Answered: Yes.

#105
post #98

Earlier quoted context omitted.

Right. And this gets to the heart of the matter. I do not use languages just based on what other people use it for. I completely agree, most people abuse Java using it in stupid ways, writing absolutely ridiculously verbose and complex needless code, using XML for everything etc etc. But that's not Java's fault. It's simply the fact that it looked attractive to Enterprise and they threw their crapstorm at it. If sudd…

The reason why you want popularity is because they write libraries for you. That means you can worry about something more interesting than an HTTP parser. Or, it means that if you want to write an HTTP parser, lots of people will help you. If you are the only person in the world and refuse to collaborate with anyone, then it doesn't really matter what language you use. Except, of course, the compiler and runtime are…

> If you are the only person in the world and refuse to collaborate with anyone, then it doesn't really matter what language you use.

Yup! And FWIW, I wrote an HTTP parser. And webserver. And DNS server. Amongst other bits and pieces I needed for Mibbit.

Programming isn't rocket science, I think more people should write everything themselves rather than rely on 3rd party libraries personally.

Yes, it's an investment to write your own libraries, but you end up knowing more, being able to maintain/fix bugs far easier, and often ending up with a far better solution.

Re: "Should I still learn Java?" Answered: Yes.

#106
post #84
post #64

Earlier quoted context omitted.

> which would take any kid hours > Your "argument" if you can call it that From Hacker News guidelines ( http://ycombinator.com/newsguidelines.html ): "Be civil. Don't say things you wouldn't say in a face to face conversation. When disagreeing, please reply to the argument instead of calling names."

I would certainly say a lot worse face to face :)

I think the guidelines assume you act socially in real life.

Re: "Should I still learn Java?" Answered: Yes.

#107

Earlier quoted context omitted.

>> Strong push towards threading. Before NIO, there wasn't a way to avoid threads if you wanted to talk to multiple sockets. NIO has solved that for networks, but the whole java framework/idioms push you towards threads where it shouldn't. > Where? I'm starting to think people dislike Java for the community / way it's used in enterprise rather than anything to do with the language. There's no push toward threading in…

I agree with your rant and am grateful for every day I don't have to program in Java. Also, I just noticed your username... are you the same beagle3 as on Reddit? If so, I like your comments, particularly the ones about APL/K/J.

Yep, same me :)

Thanks.

Re: "Should I still learn Java?" Answered: Yes.

#108
post #36
post #15

Earlier quoted context omitted.

public static void main(String[] a) { System.out.println("Hello world");} Yeah you're right. That's an insane amount of typing which would take any kid hours. I had to muster up all of my patience just to type all that code out. You're right! Java is so verbose! Your "argument" if you can call it that, is like people saying lisp is crap because it uses too many brackets.

You forgot the class foo { ... } And that it has to be in a name called foo.java. And that you have to compile it and run it with java foo instead of simply ./foo And that startup time of JVM is orders of magnitude worse than pretty much anything else.

> And that startup time of JVM is orders of magnitude worse than pretty much anything else.

This one never ceases to annoy me.

The JVM is optimized for LONG RUNNING PROCESSES. It's targeted specifically toward running on servers, because that's the default use case. There's about a million options switches, gc controls, etc if you want to run it in another way.

If you want fast startup time, try compiling with gcj or something.

In any event, I run a javac->java loop many times an hour when developing, and the startup time is un-noticable.

Post reply on HN