Hacker News new | ask | show | jobs
by nessus42 5322 days ago
Where I worked, we switched from Java to Scala a few months ago, and we're all loving it. I really don't understand Stephen Colebourne's criticisms. Well, actually, sure I understand every one of his criticisms, but I could make equally damning or more damning criticisms of just about every programming language. No programming language is perfect. On the other hand, we find Scala to be much more expressive than Java. In Scala, I can write code in a natural way, rather than the way that Java wants to force me to write it. The result is cleaner, more elegant code, that is significantly shorter with much less boilerplate and code repetition, and easier to understand.

Sure the type system is complicated, but I don't really have to understand all its nuances in order to get my program to compile and work. When you use Scala, after a short while you just develop an intuition for it.

The comparison to EJB 2 is a bit nutty, if you ask me, since writing code in Scala tends to be the antithesis of all the terrible Java monster enterprise library crap. The libraries that people use in Scala tend to be much simpler and more straight-forward.

I do agree that there's a contingent of the Scala community who seem to want to rub their fluency with category theory in your face. This is hardly representative of the entire community, however, and I'm sure they must exist in the communities for almost every functional programming language these days. The solution for this is for people to come up with more intuitive explanations for the powerful tools that category-theory inspired abstractions provide. I know that this can be done, and it will be done, when functional programming become mainstream enough that it attracts better writers.

(I, myself, have been thinking of writing up a little essay called "The Mapcat is the state monad of Massachusetts" to try to explain monads in a better way than comparing them to space suits, or whatever. Okay, okay... mapcat isn't a state monad, but I think the title's funny anyway.)

1 comments

“Sure the type system is complicated, but I don't really have to understand all its nuances in order to get my program to compile and work.”

This is key. People sometimes look at the type signature of the map method (as above) and freak out. It's good to try and understand everything, mind you, and eventually you probably will. The key here is that the crazy signature of the map method simply means the map method will do what you expect. That's it! “But I would write X to do it in my language” is irrelevant, because you don't write the map method. It's provided. There's a paper that describes why the signature is how it is and everything, but you don't care, because it's complicated so that when you're actually using it, it just works.