Hacker News new | ask | show | jobs
by djhworld 5055 days ago
I use Java in my day job and it's easy enough to write code in.

The problem with it for me is, it's totally unusable for writing quick command line scripts/applications because you need to either

a) Run java -cp <classpath> <class-with-main>

b) Write a shell/batch script to do the above.

Then there's the lack of good stuff found in modern languages like first class functions.

It's not all bad though, recently I've been learning Go and the lack of generics makes me pine again for Java like a long lost love.

2 comments

Really? requiring a shell alias or a one line shell script to shorten your invocation makes the entire language 'totally unusable'?
You kinda have to agree that writing anything in Java isn't exactly... "fast". That said, I don't use Java for "quick answers" -- if I want something that super easy and needed tomorrow, I'll do it in Ruby (especially if I know that it's not going to need to scale massively or get tons a hits and requests).
It makes distribution a PITA and faffing around with the classpath string is also a PITA
I'll be honest, though I have my issues with Java, I've been following along with James Gosling as he's transitioned through different projects and I have to agree with one thing that I think really differentiates Java from newer languages--when you really need to scale in orders of magnitude (like Twitter), then Java is beast. It doesn't make it easy, but then again, the solution to difficult and large problems wasn't going to be easy to begin with.
> when you really need to scale in orders of magnitude (like Twitter), then Java is beast.

The core Twitter service is still a Rails app though. There is nothing inherit to a language that makes it scale better than another, but different languages are better suited to different problems. As a result, Twitter does make use of Java in some capacity, but they also use a plethora of other languages where they make the most sense.

I'm not familiar with scaling Java, but I've worked with the language itself on Android. What makes it so great for scalability as opposed to something like Ruby?

If you are using Rails, the database is the problem 99% of the time, not Ruby. MySQL can easily* be scaled / denormalised / sharded then if you need to you can just horizontally scale your app servers.

(*As easy as MySQL can. It isn't a black magic though, there is plenty of documentation, e.g. http://www.mysqlperformanceblog.com/)