4 ms·
I have similar opinions on Scala, lots of theory that it makes things better, but the only measurable difference is that its a nightmare to hire for, more expen
by captaincaveman 5y ago
I have similar opinions on Scala, lots of theory that it makes things better, but the only measurable difference is that its a nightmare to hire for, more expensive and we often have to invest time training people ... who then leave to become contractors.
I'm not anti functional or Scala, but I'm yet to see any reports etc that actually indicate there is a pay off.
- grumpyprole 5y agoI don't even view Scala as a functional language, as functions (methods) are not first class. Lambdas are encoded as objects with a single method. It's much more expressive than Java and so better at expressing many functional programming ideas, but it's not a functional-first language, it's an evolution of Java. The underlying issue is that it's a complex language with many experimental and interacting features, which can and do cause a lot of distraction. This is not the fault of functional programming. Have a go at OCaml or F#, which are nice practical sweet spots.
- hocuspocus 5y agoThe JVM has had specialized bytecode for SAM types for a long time now, you cannot really get more "first-class" than that. And really it's just an implementation detail than doesn't make the language more or less functional. Scala isn't simply an evolution of Java. It offers a type system that goes beyond what you can do in F# or OCaml. The fact it's multi-paradigm and plays nice with Java's OO model doesn't make it less functional than these two.
- grumpyprole 5y ago> it's just an implementation detail than doesn't make the language more or less functional. It affects the language very much, awkward currying and tupling, needing to wrap methods in objects. Subtyping also has many complex consequences. There is limited type inference and tail call optimisation versus functional-first languages. > Scala isn't simply an evolution of Java. It offers a type system that goes beyond what you can do in F# or OCaml. It offers higher-kinded types, but F# has units of measure, OCaml has polymorphic variants. Each has advanced features not offered by the other. > The fact it's multi-paradigm and plays nice with Java's OO model doesn't make it less functional than these two. It was not designed as a functional programming language first and foremost, that is my point.
- captaincaveman 5y agoI'll also add that scala/functional engineers are also more likely to focus their energies on monads and type theory rather than product delivery. I get that it is probably more intellectually stimulating for many engineers than the project they are working on, but it also reflects in over engineering of distributed systems for simple problems. I do wonder if there is really any net gains for a company to go the functional route. I would love to see some research on this as people have been championing it for decades now, and seems suspiciously absent!
- hocuspocus 5y ago> I'll also add that scala/functional engineers are also more likely to focus their energies on monads and type theory rather than product delivery. Then how do you explain that a very significant number of "top" tech companies have teams who manage to deliver products written in Scala or other FP languages?
- captaincaveman 5y agoTeams have managed to deliver products in also sorts of languages, Cobol for example. Did the choice of language benefit the delivery, maintenance and TCO is my question. If I choose Haskell/Scala over Java (FYI as a programmer I'm not a fan of Java) what benefit will it actually bring the business, and does it out weight the negatives, over what time frame and how much risk?
- hocuspocus 5y agoThere are technical tradeoffs everywhere. But you cannot make a caricature of FP developers, supposedly not willing to spend energy on delivering products. Lots of tech companies have proved that you don't need to follow Google and constrain your workforce to a small list of vetted languages. Most teams who chose Haskell, OCaml, Scala, Rust... are productive and able to deliver products.
- 5y ago
- barrenko 5y agoYup, Scala is to Haskell what F# is to Ocaml.
- 62951413 5y agoI remember perusing a book on ML (the language) and having aha moments such as "so this is where the '_' naming convention comes from" and "this is where pattern matching was borrowed from". Monads (aka zio/cats) are not built-in, the "lazy" keyword is a far cry from strictly lazy evaluation. I say "Scala to Ocaml" on the JVM is equivalent to "F# to Ocaml" in the .NET world (there must be some category theory joke in this topology).
- sideeffffect 5y ago> Scala is to Haskell what F# is to Ocaml That's not quite precise, IMHO. F# is an awesome language that I hold very dear, but it is a castrated form of OCaml. It has only a few features that OCaml doesn't have. For example Type Providers or Unit of Measurement. These are nice and useful features, they're not gimmicks, but they're not fundamental. On the other hand, Scala isn't a hollowed out Haskell. Haskell, admittedly, is a more powerful language and has features Scala doesn't, like a linear type system. And it's just different, non-strict, whereas Scala is strict. But Scala is also very powerful in other fundamental areas, where Haskell is weak. Scala has a superior module system, it's biggest strength IMO. Haskell's modularity story is that great AFAIK.
- sideeffffect 5y ago> I don't even view Scala as a functional language, as functions (methods) are not first class. Lambdas are encoded as objects with a single method. It's much more expressive than Java and so better at expressing many functional programming ideas, but it's not a functional-first language, it's an evolution of Java. It' technically true that Scala's fundamental building block is object, not function. But that is in my eyes more of an implementation detail. Scala is a language that blurs the distinction between FP and OOP to the point of meaninglessness. You can do FP and still organize your code into classes/objects/traits (aka modules). You can choose to do side effects. Or you can waive them and do pure FP (like in Haskell) with TypeLevel or ZIO. > it's an evolution of Java I would say that it's kanda the other way around. Scala is a beacon that almost all languages are converging towards, not just Java. https://www.lihaoyi.com/post/FromFirstPrinciplesWhyScala.html https://www.lihaoyi.com/post/FromFirstPrinciplesWhyScala.htm... > complex language with many experimental and interacting features It doesn't have that many features. Some people even call Scala simple for this reason. But the features that is has are _very_ powerful. Some maybe even too powerful for my taste (implicit conversions anyone?). And they're orthogonal so they can be composed together. Sadly, such composition can be brittle and non-beginner friendly, especially when it fails -- things like weird type errors or weird unexpected behavior at runtime, or compiletime for that matter, etc. So Scala will give you a lot of rope to hang yourself onto, if you'll be blindly taking it. But it doesn't have to be that way. You (or a senior developer) have to know what you're doing. Then you can reap significant benefits. It's good news that Scala 3 significantly improves on this front -- it emphasizes programmer's intent instead of Scala's internal mechanics. Sure, in some languages, this risk isn't even on the table (Go, etc). But having power also comes with benefits, not only the potential problems I've described above.
- grumpyprole 5y agoI'd be interested to see Scala 3, my comments/opinions apply to Scala 2 only.
- 62951413 5y agoThere are two flavors of Scala and only one of them is about cats/scalaz. I feel intellectually inferior to people who use the latter in production. But I don't think anymore it's a reasonable aspiration to become one of them. And maven builds Scala projects equally well (with half a screen of XML) and without any SBT complexity. I have not seen Bay Area companies where previous Scala experience counts for more than inviting me to an interview. In my current team I know multiple developers who'd like to have more Scala and Java developers who don't know Scala or even Kotlin.