6 ms·
Other than the community and leadership issues mentioned in the article, Scala will never be enterprise ready because I can't think of a worse language for the
by pron 13y ago
Other than the community and leadership issues mentioned in the article, Scala will never be enterprise ready because I can't think of a worse language for the enterprise. Large IT departments working on multi-MLOC codebases need a solid, clear language. Scala was promising back when it was meant to be "a better Java". And you know why people liked it? Mostly because it had lambdas and traits - two features that are in Java 8.
Since then, Scala has become a sort of a testbed for new ideas in compiler technology. Consider this – it's basically got three complete type systems: an OO, inheritance based type system, a Haskell-like algebraic type system (sealed traits and case classes), and a duck-typed type system (structural types). Each of these type systems has been enough to write good, complex software, on each own. Scala's got all three, while at the same time missing on all of their advantages. It doesn't have Haskell's type safety and purity (or type inference). It doesn't have OO's simple, highly extensible, and just-powerful-enough type system, because it's so big and complicated, and it doesn't have duck-typing's care-freedom, because it's so heavy. Oh, and it's got macros, too, just for the heck of it.
I know some people like it because they have fun writing lisp, Haskell, Java and JavaScript in the same file and have it compiled by just one compiler. Yeah, it's a cool compiler. But seriously, it doesn't offer anything enterprise would want. It doesn't offer safety; it doesn't offer simplicity; it doesn't offer familiarity. It doesn't even offer much compatibility: it's much harder to integrate Java with Scala than with Clojure or Groovy, let alone Kotlin.
And I'm willing to bet that almost all large companies that currently employ Scala, do it because of its original promise of being a better Java. But if you're a superset of about 4 language families, than you clearly can't a better Java.
For those who want that productivity boost while maintaining familiarity and compatibility, there's Kotlin. And Java 8, of course.
- runT1ME 13y ago>And you know why people liked it? Mostly because it had lambdas and traits - two features that are in Java 8. I don't think this is the main reason people like it. Java's lambdas are also inferior to Scala's. >a Haskell-like algebraic type system (sealed traits and case classes) What do case classes and traits have to do with types? >It doesn't have Haskell's type safety How so? Can you explain how you think Scala isn't sound/typesafe? >It doesn't have OO's simple, highly extensible, and just-powerful-enough type system Uhm, can you explain to me an example of a simple OO type system that is 'just powerful enough'? Because most of the ones I know of are broken, and Scala easily has the best OO type system. C#, java, Go, etc. are all either missing generics (lolwut) or completely fucked up variance.
- tikhonj 13y agoClasses are types. And in Scala, case classes are just an awkward take on algebraic data types. Scala doesn't even come close to Haskell. For one, it does not do anything to capture effects in the types. Apart from being markedly less safe, this also makes things like STM impractical. Additionally, implicits may be more powerful than typeclasses, but they're also easy to mess up: you lose canonicity. In Haskell, if you have a Set a, you know it uses the same ordering of a as any other Set a; in Scala, you lose this guarantee. You also don't have any notion of kinds, which makes quite a bit of otherwise-idiomatic code hard to write. Take a look at this post[1] for more examples and details. [1]: http://www.reddit.com/r/haskell/comments/1pjjy5/odersky_the_trouble_with_types_strange_loop_2013/cd3bgcu http://www.reddit.com/r/haskell/comments/1pjjy5/odersky_the_... If you want a simple yet powerful OO system, take a look at OCaml. It does OO much better than any other statically typed language I've used. The funny thing is, of course, that people don't use OCaml's object system--not because it's bad but because by the time you're using OCaml, you've already realized functional programming is the way to go. Most of the reasons I've heard for not using OCaml's object system apply even more to other OO languages! OCaml's object types are expressive and, unlike Scala, fully inferable. And they don't mess variance up! You also get a dual sub-typing with polymorphic variants--I don't know if Scala can do anything comparable with case classes.
- runT1ME 13y ago>You also don't have any notion of kinds, which makes quite a bit of otherwise-idiomatic code hard to write. I'm not sure that is true. Otherwise this would not be possible: class MyExample[A[_]](a: A)
- tikhonj 13y agoYeah, I think that part was a bit inaccurate. The core problem is more like the fact that higher-kinded code is hard to write. You always end up writing in terms of concrete types--you can talk about A[_], but not about A by itself. This becomes a hassle when working with things like monad transformers.
- 13y ago
- ShardPhoenix 13y agoWhile Scala is indeed a bit overly complex (concept-wise), in practice working with both at an "enterprise" I've found it better overall than Java. Also, neither Kotlin nor Java 8 are available in non-beta form yet. My biggest complaint about Scala isn't the language itself, but the flakiness/immaturity of some of the libraries/frameworks/tools compared to Java.
- lmm 13y agoEnterprise does need scala. You can tell by the way any enterprise java codebase ends up with five different sets of annotations, two almost-compatible AOP systems and a clusterfuck of XML tying it all together. Yes, scala is more complicated than java, considered in isolation. But you can write a large program in pure scala, rather than the bloated enterprise frameworks you end up with in java.
- pron 13y agoThat's not a language issue but a library issue, and modern Java libraries are not like that at all. Hell, Scala programs use them just as much as Java programs do. If anything, Java is showing that it can clean up years of cruft (Java EE 7 is pretty neat, and even the JDK is finally being modularize) while maintaining backwards compatibility. This is the kind of thing Enterprise wants and needs.
- kamaal 13y ago>>That's not a language issue but a library issue What is this, 1985? Libraries, frameworks and the community etc make the language these days.
- deleted 13y ago[deleted]
- jaxytee 13y ago>it's much harder to integrate Java with Scala than with Clojure or Groovy, let alone Kotlin. Your kidding right? Scala's Java interop is seamless compared to that of Clojure.
- pron 13y agoI'm not sure what you mean. Clojure's abstractions (seqs and maps) are completely compatible with Java collections and require no conversion in either direction, while Scala collections do.
- felipehummel 13y agoYou can actually make it automatically convert in both directions with just an import. But it is good practice to do it explicitly. In my opinion, for a typesafe language, this is a good way to do it.
- pron 13y agoThe conversion, either implicit or explicit, is not free, neither in terms of performance, nor in terms of mental effort. This is not the case with Groovy, Kotlin and Clojure (though Java interoperability in Clojure does require more mental effort than in Groovy and Kotlin).
- eeperson 13y agoI would argue that Groovy and Clojure require just as much conversion (I have no idea about Kotlin). Scala and Clojure both require conversion if you want to use idiomatic data structures. I think Groovy is actually worse about this because you get secret implicit conversion to add meta classes and null objects. I've run in to a bunch of difficult to track down bugs where Groovy has forgotten to do these conversions.
- felipehummel 13y agoYou can actually make it automatically convert in both directions with just an import. But it is good practice to do it explicitly. In my opinion, for a typesafe language, this is a good way to do it.
- kamaal 13y ago>> But seriously, it doesn't offer anything enterprise would want. The only thing enterprise managers want is a language that can dumb down the art of programming to a level a programmers can be managed like assembly line workers. And that is what Java does exactly, an IDE that can make a novice and expert work at the same levels of productivity, extremely verbose code that gives an illusion of people building something big(even if its down right trivial). And most importantly programming effort can be accounted like a couple of least important replaceable folks down the hierarchy doing some assembling reusable units of material. Change this scenario, a good technology with merit makes programmers very important and makes managers look like desk clerks. Enterprise Managers don't care a least about type systems, lambdas, or traits or whatever. Most managers don't have a remote clue what those things are. Can the technology enable them to manage herds of programmers dumbed down enough to be managed like sheep? That is all they care.
- pron 13y agoNo one (well, other than language designers) cares about traits and lambdas per se. People care about maintainability, performance, productivity, runtime diagnosability etc., and "enterprise managers" care about these things a lot. That is why the whole world, almost, switched from C++ to Java faster than it's taken the smallish Python community to switch from 2.7 to 3.0. I won't go into an argument over verbosity, because Java is indeed verbose (about the same as Go and less than C or C++, that were what many in Enterprise used before). But as to the "assembly workers" kind of thing - it is far more complex than that. First, in no language is a novice as productive as an expert; not in Java, not in C and not in Haskell. Second, lots of enterprise projects are far from trivial. Some projects are so damn big that no matter what language you use, it's gonna take a couple of years, several million LOC, and at least several dozen developers, if not more than a few hundreds. Once that's the case, productivity means something else entirely, and yes, planning for team members coming and going is part of it; I think that in that respect Java hit a sweet spot. Obviously, it could be made better; it could be modernized. Personally, I also believe that the JVM is such a great polyglot platform, that projects should be written in several languages – yes, even in the enterprise. Not all enterprise managers are stupid, and there are good reasons your bank doesn't run on Ruby or Python. Enterprise software technology changes all the time – yes, some of it is due to excellent sales team, but some of it is based on merit. You wouldn't expect that software technologies that are good for constantly pivoting SV startups would be equally good for running banks; or aircraft carriers. The requirements are just too different. Python has its place, as does Java. It's just not always the same place.
- pkolaczk 13y agoI moved from Scala back to Java (not because I like Java so much, but because the current project requires it). And lambdas and traits are not the main features I miss. Much more I miss lazy evaluation, pattern matching, much better type system (variance, type classes, dependent types, even erasure is not that painful) and awesome collection library. None of those things are in Java 8, nor planned in any future version.