3 ms·
> Scala is the most expressive and powerful language on the JVM, hands down. So I'd agree with that statement... > do yourself a favor and use Scala ...but n
by nostrademons 7y ago
> Scala is the most expressive and powerful language on the JVM, hands down.
So I'd agree with that statement...
> do yourself a favor and use Scala
...but not that one.
I've found that Scala gets too expressive, much the same way that writing production code in Common Lisp or Haskell can be slower than just writing it in Python. It offers incredibly powerful abstraction capabilities that can often dramatically reduce the amount of code you write; but at some point you end up spending more time hunting for the perfect abstraction than actually writing the code. The ideal programming language (for productivity at least, not necessarily for fun or erudition) is one that melts into the background when you program so that you can focus on the problem domain rather than the program. That's the main appeal of languages like Go, Java, and Python: they offer just enough power to write the program, but not so much that you can write the program in a dramatically better way and end up tempted to try and find that way. Kotlin embraces the "it's just a better Java" approach: it's a minor re-skinning of the concepts in Java, and to the extent that it introduces new language features (like closures, lambdas, properties, data classes, anonymous objects, type inference, and immutability), they're all concepts that skilled Java programmers would be immediately familiar with but would otherwise have to write lots of boilerplate for.
The Java interop story is also better with Kotlin, because Scala introduces abstractions for which there are no obvious Java equivalents, and hence there's an impedance mismatch when you try to envision how your Java libraries might fit into your Scala program. Kotlin's designers took care to make sure that there's an easy, intuitive mapping between Kotlin concepts and Java ones, usually one that had already been enshrined in existing Java conventions (eg. JavaBeans work nicely with properties, functional objects with lambdas), so most Java libraries just work in an obvious way. Basically they intentionally made it dumber so you don't have to think about as much, which is a win for everyday programming.
- smabie 7y agoI guess I'm not an everyday programmer then? I want the machine to work for me, not the other way around. I find it absurd when I find programmers actually arguing for less power and less abstraction, it's like arguing for less free speech or less freedom: contrary to your own interests.
- nostrademons 7y agoI thought the same way when I got out of college, but changed my mind after a decade or so in the industry. What changed could be neatly summed up by this post: https://www.kalzumeus.com/2011/10/28/dont-call-yourself-a-programmer/ https://www.kalzumeus.com/2011/10/28/dont-call-yourself-a-pr... Basically, I used to program for the intellectual challenge and the thrill of programming itself. If that's your goal, by all means use Scala or Haskell or Lisp. But at some point that faded, and now I program because somebody has a problem that they will pay me to solve or (for various startup ideas) because I want to understand the market or some data source that has the potential to be worth a lot to a lot of people. For these, my focus is on the problem - the programming is a means to an end for solving the problem, and so anything that lets me spend less brainpower on the programming and more brainpower on the problem domain is a net win.
- smabie 7y agoYou can program in Scala just like Java, with both hands tied behind your back if you please. If you can’t restrain yourself and not use free monads or whatever, that’s on you, not the language. I’ve worked on enterprise Scala code bases for a number of years, and no single person on the team would ever switch to Java. In fact, while many of them started as Java devs, many have sworn to never take another Java job in their life.