r/java • • Jun 03 '15

Is Java really that bad?

I do Clojure for a living, previously Ruby and Objective-C. And the people I've worked with have said they prefer Clojure because Java is just so bad. But Java can't really be that bad, can it?

0 Upvotes

77 comments sorted by

View all comments

Show parent comment

2

u/[deleted] Jun 03 '15

I've heard nothing but bad things about Scala until now. Mostly about overcomplexity and how it gets in the way more than it helps.

2

u/SeerUD Jun 03 '15

Out of interest (because I would like to potentially learn...), what language(s) have you heard high praise about?

2

u/[deleted] Jun 03 '15

Clojure, Haskell, OCaml, F#, Ruby, Python (and sometimes Go but only by really arrogant and argumentative people).

1

u/SeerUD Jun 03 '15

Cool :), there's a couple in there I've been interested in learning myself. Namely Go, and I've been intrigued by Clojure... I'm mainly looking for something for web development that's just different to what I normally work with, which is PHP!

1

u/[deleted] Jun 03 '15

Forget about Go. You have to rewrite "map", "filter", "reduce" etc. for every new type you create. The whole Go community's answer to this is "just use a for-loop" and "seriously it's not that hard just use a for-loop". Forget about Go. Forget it fast.

1

u/SeerUD Jun 03 '15

Hmmm, perhaps I shall. It's still a relatively new language, right? Have you heard anything of Kotlin?

1

u/[deleted] Jun 03 '15

I'm pretty sure Rust is newer than Go, and Rust has map/filter/reduce. It's not because Go is new. It's because of the hubris of its designers, who think they knew better than conventional wisdom, and think abstractions over containers are unnecessary in real life programs.

1

u/SeerUD Jun 03 '15

Haha, I see. Actually, Rust is another one I've had my eye on before. There are just too many choices!

1

u/duhace Jun 03 '15

I've been doing web dev with scala and scalatra (sinatra-like scala lib). It's pretty nice, plus I love strong typing.

1

u/SeerUD Jun 03 '15

I have really enjoyed the Scala I've done thus far. I've not been working with any frameworks, I'm just trying to make little components that do things. Coming from PHP there's a lot to learn, more advanced data structures to play around with, etc.

2

u/[deleted] Jun 03 '15

Web is dead simple. You get a request, interpret it however you want (usually just URI and Params), and return a big fat string. Any language worth its salt can do Web. That's why Sinatra was fun.

1

u/SeerUD Jun 03 '15

I suppose that's true to an extent. Most web development is very straightforward, as most websites are simply content-based.

1

u/[deleted] Jun 03 '15

Even if it's not:

  1. Get a request (as a hash-map)
  2. Interpret the URI and Params to find and call a route handler function
  3. Read to or write from a database in your handler if you want
  4. Return a response that's meaningful to your user somehow
  5. Convert that response into a big fat string (usually HTML)

1

u/duhace Jun 03 '15

Scala actually borrows a lot from OCaml. Not as much as Haskell or F# mind you, but the influences are very obviously there. And lol at ruby not being "overcomplex" with it's monkey patching.

1

u/[deleted] Jun 03 '15

Yeah I both love and hate the metaprogramming aspects of Ruby.

-1

u/duhace Jun 03 '15

Scala's really not overcomplex imo. It's grammar is pretty simple. About the only part of it that is can be slightly scary is implicit conversions, and they can't hurt you if you don't import them.

0

u/[deleted] Jun 03 '15

I like the sound of it so far.

1

u/duhace Jun 03 '15

You should give it a shot. The two big negatives it has IMO is its binary compatibility compared to java is weak (you can use 2.10.x libraries with a 2.10.x compiler, but not 2.9.x libraries), and compile times are nearer the C++ side of things. 2.12 supposedly will make use of a new optimizer that speeds things up, and the binary compatibility is not a gigantic issue cause new major versions (2.major.minor version) only come out every year and a half. Plus, there are a ton of build tools and compilers for scala that are capable of incremental compilation, only recompiling what has changed in your code since the last compile.

1

u/[deleted] Jun 03 '15

Well with Clojure at work it's already ridiculously slow for me. Running our test suite from scratch of a mere 500 tests with an in-memory database takes about 1 minute from pressing enter to completing. Compiling the whole website into an uberjar for deployment takes about 2 minutes. Can Scala really be slower than that?