11 ms·
In Defense of Scala. Response to “I Don’t Like Scala”
- lmm 13y agoIt would be nice to have more substantive criticisms. While I dislike SBT[1], scalaz and spray are a large part of why I enjoy scala so much. While akka was so difficult to use that it almost soured me on the whole thing, and shapeless' monstrous compile times made it practically unusable. So don't think this post represents some kind of consensus. [1] The notion of configuring your build tool in a full programming language is alluring but ultimately a bad idea IMO; builds should be simpler and more declarative than that.
- taeric 13y agoAgreed, I would like to hear more specifics on why spray was so maligned. Scalaz is a library that I wish I grokked better, but in all I think it has hurt as much readability as it ever hoped to help. That is, learning the concepts I fully want to do. Using the opaque names, not so much. I'd rather have that level of understanding on my target domain, not category theory. (Were I only smart enough to do both...) I also agree regarding Akka. I want to like it, but I also feel it purposefully makes things complicated. It was hilarious to read the quote from Torvalds saying that "distributed algorithms are really hard" in context of why microkernels are hard to do, and then see Akka basically say that they make it so that all algorithms are written in a distributed way. Or sad. Not sure which.
- eklavya 13y agoI have found Akka and the actor model to be pretty straight forward, easy to use and understand. I think it makes writing distributed algorithms a breeze (first hand experience). Can you give more details about what you found complicated in it?
- taeric 13y agoDistributed algorithms, in general. :) Don't get me wrong, if what you are doing is already a distributed algorithm, then it doesn't hurt. But turning all algorithms into distributed algorithms just seems crazy. Unless, I suppose, you don't care about such things as speed and memory consumption.
- eklavya 13y agoDon't use the wrong tool for the job, it's as simple as that. On Akka home page, in bold "Build powerful concurrent & distributed applications more easily."
- saryant 13y agoAgreed. We run an Akka cluster with 5-6 nodes as our backend, clocking in at 15Kloc. It's been running for months now with no problems. If we need to add capacity, we just provision a new EC2 instance with Vagrant/Chef and it auto-joins the cluster. Once we're done, we can remove it gracefully and the rest of the cluster just deals with it.
- JackFr 13y agoMaven always had a number of issues -- SBT came along and solved none of them and introduced a few new ones.
- timclark 13y agoThe last time I used SBT, which was well over 3 years ago, the SBT file wasn't really valid scala - this may not be the case now.
- benburton 13y agoI know that I'm in the vast minority, but I don't see what people find difficult about SBT. For the most part, it seems to keep itself out of the way. I would say I've found it only slightly more cumbersome than Rake, and a breath of fresh air when compared to the JVM alternatives (although I haven't had first-hand experience with Leiningen).
- eklavya 13y agoI am with you brother, I like SBT. Plain and simple.
- lmm 13y agoIf used with discipline it's fine. But it ends up encouraging people to put complex logic in their build files. I prefer the rigidity of maven, where it's simply impossible to do e.g. conditional dependencies.
- benburton 13y ago> If used with discipline it's fine. I think this is actually an astute criticism of Scala as a language, and not just the SBT library; it holds true for many of its more unconventional features. Scala is probably not a good language choice if you/your team are prone to shooting themselves in the foot.
- frowaway001 13y agoI can't understand that. Maven is the absolutely worst cluster fuck in terms of a build system I have ever seen. I can't deal with Maven's position of "Oh, you want to have some tiny bit of intelligence in your build? Guess what, a) fuck you, b) write a crappy plugin for it." anymore after seeing that simple things can be indeed simple and straightforward with SBT.
- asdasf 13y agoThat's a pretty terrible defense of scala. Sounds more like a "I hate some random scala projects for made up reasons". How does scalaz have "colossal snobbism" exactly? Because it contains stuff you haven't learned?
- octo_t 13y agoThe community around Scalaz is notoriously hostile (I've not experienced it myself however)/
- virtualwhys 13y agoAgreed, doesn't paint Scala in a good light despite claiming to defend it. As for Scalaz elitism, the canonical example would be the T-hole himself, _ Morris (who has more or less been expelled from the main Scala user groups). I think the general POV the OP is trying to convey is that Scalaz is an incomprehensible cluster fuck of symbols to everyone but those in the know; in other words, the learning curve is steep and historically the response to beginner questions has been something along the lines of, "go read this paper" a la Haskell. SBT suffers a similar problem but that's, IMO, more due to lack of IDE support for the project/ build than anything else (i.e. it's difficult to discover [for me] the library without being able to click through method calls and experientially explore the code [Scala docs only get me so far]). In other news the last milestone of Scala 2.11 was just released; 2014 should be a good year for Scala on many fronts (faster compilations and improved IDE support particularly)
- asdasf 13y ago>I think the general POV the OP is trying to convey is that Scalaz is an incomprehensible cluster fuck of symbols to everyone but those in the know Right, I get that there are lots of scala people who are very anti-intellectual and are vehemently opposed to learning anything. But what I don't get is how "if I don't learn this stuff, I don't understand it" is "snobbism" on the part of people providing the library you didn't learn. >and historically the response to beginner questions has been something along the lines of, "go read this paper" a la Haskell. I have not seen that response in either scalaz or haskell. It sounds an awful lot like the common strawman used to dismiss haskell as "academic" from people who have never bothered to try it. Practical experience with haskell in particular has been that people are ridiculously accommodating and helpful.
- kasey_junk 13y ago"For sane type-level programming look at latest Scala collections" Is this a joke? The Scala collections library are terrible. They are inconsistent, hard to reason about, suffer from scope creep, and have terrible performance characteristics.
- octo_t 13y agoEvery time I've used Scala collections, they've behaved exactly how I'd expect them to. What parts of the collections perform poorly?
- kasey_junk 13y agoThe scala collections (even the mutable ones) generate tons of garbage (e.g. getting a value out of a map automatically creates another new object). Scala hashmaps (even the mutable ones) are much slower than equivalent java collections.
- thescrewdriver 13y agoIt seems that the performance difference has little to do with temporary objects, but is to be fixed 2.11 anyway: https://groups.google.com/forum/#!msg/scala-internals/Fw37NmUUiqs/k9jxMXDYEhYJ https://groups.google.com/forum/#!msg/scala-internals/Fw37Nm...
- sukaka 13y agoA recent comparison was made with scala and java collections. Lots of interesting tidbits. http://www.takipioncode.com/2014/01/23/java-scala-guava-and-trove-collections-how-much-can-they-hold/ http://www.takipioncode.com/2014/01/23/java-scala-guava-and-...
- ionforce 13y ago> getting a value out of a map automatically creates another new object Do you have a code sample for this?
- 13y ago
- NigelTufnel 13y ago"Brilliantly simple" is an odd description of Scala. I would easily put Scala in the top 3 most-difficult-languages-for-me to work with. Maybe even top 2.
- btd 13y agoWhat is on top?
- NigelTufnel 13y agoTemplate-heavy C++ and point-free Haskell code.
- binarymax 13y ago"intellectual laziness of dynamically typed languages" Ouch. So if I choose to use python, ruby, javascript, lisp, - I am 'intellectually lazy'?
- stcredzero 13y agoAll one has to do to avoid intellectual laziness as a programmer, is to have enough curiosity to constantly re-establish how much one doesn't know. The surprising part is that it might take 10 years to approach an accurate answer. Also, as you probably know, it's possible to program static typed projects in a Lisp.
- lmm 13y agoThe world was different when those languages were designed; type theory was not as mature as it is today. IMO if you're designing a new language today and not giving it a real type system, yes, that's intellectually lazy. As for using them... eh. My subjective view is that scala is much better than all those languages, outside certain small domains. But that's not exactly objective fact. I will say that if you don't know scala then you're being intellectually lazy - even compared to ocaml, it's different enough to be worth knowing, and it's a language you'll learn something from, whether you ultimately find yourself using it or not.
- rwallace 13y agoYes, and this is a feature not a bug. As Larry Wall observed, three cardinal virtues of a good programmer are laziness, impatience and hubris. Laziness is important because I have more things on my to-do list than hours in my lifespan, and more things I need to know than neurons in my brain. I didn't choose Python only or even primarily because it's dynamically typed, but nonetheless, every thought I don't have to think about static types is a thought I can instead think about something I actually care about.
- asdasf 13y agoOdd that you cite Larry Wall given that he thinks haskell is one of the most important languages for any programmer to learn. I always find it weird that people try to use someone famous to support their opinion when that famous person disagrees. Perl lacks a type system because that was what made the most sense for perl. That doesn't mean it makes the most sense period. >every thought I don't have to think about static types is a thought I can instead think about something I actually care about. Static types do not add something to think about. You already have to think about what things are. Static types just let the compiler ensure that you didn't make any mistakes. Passing a user object into a function that wants a string isn't suddenly useful because there is no type system giving you an error.
- aidos 13y agoI had my first experience for Scala last week with doing the Stripe CTF. I really liked the look of the language and I started trying to develop my solution in it. I knew exactly what I wanted to do, and had a reasonable idea of what to write to get there. Holly molly, compilation times were absolutely horrible. I tried to persevere but a tiny change would mean 2 minutes waiting for a recompile. In the end I just switched to python where I could develop a solution from scratch (remember, the Scala solution was 90% finished) in no time at all. Would like to look closer at the language one day but I have better things to do with time than waiting for a machine to churn through code.
- lmm 13y agoUse incremental compilation during development, and keep your files small (this is a good idea anyway). If you're coming at it from a python background were you working in the command line? A lot of the benefits of scala only really apply when using it in an IDE.
- eklavya 13y agoI guess you were having some troubles and asked around in #scala. A huge amount of work in Scala is left for the compiler, all the niceties and features put that load on it. So while it makes life a lot more easier for you it also has more work to do. Anyways compile times have improved significantly in Scala 2.11 but more importantly, incremental compilation has landed.
- virtualwhys 13y ago> I tried to persevere but a tiny change would mean 2 minutes waiting for a recompile incremental compilation: sbt> ~run in most cases code changes should take one second. Note: SBT sub projects are God's gift to Scala devs (or Mark Harrah's gift at any rate). You have to get your feet wet in the language, trying something last week for a day or two is not going to result in you flying to the moon on the productivity spaceship of delight. Programming in Scala 2nd edition is a great intro to the language.
- aidos 13y ago
- tikhonj 13y agoIt's funny how he can dismiss Haskell as "hopeless academic idealism" and accuse dynamic language of "intellectual laziness" in one breath. Haskell is different from most languages, but that doesn't make it hopeless or academic a priori. Saying that is itself intellectually lazy, bordering on intellectually dishonest. But it is a good way to save yourself the effort of learning something new! Besides this, Scala has way too much Java in it to really be "algebraically elegant" or even simple! Scala is a compromise. It has the legacy of Java compatibility dragging it down. That's one of the main reasons it's caught on, but it's also the reason it isn't actually particularly simple or elegant. It's one of the most complex (but not necessarily difficult) languages in common use. It is nowhere near as elegant or simple as OCaml or Haskell as they can afford to be much closer to the λ-calculus. Which is also why they can afford such incredible things like tail call elimination and type inference! Also, while Scala is a multiparadigm language, it is not the best of both worlds. In embracing Java and OO, it throws away many of the advantages of functional programming. In fact, any non-trivial functional programming quickly becomes unbearable. Especially compared to Haskell. Edward Kmett wrote a nice Reddit post[1] about how Scala falls short from a functional standpoint. This is from an entirely practical commercial standpoint based on his experiences at S&P Capital IQ. Here is what he had to say about functional programming in Scala: "If scala was the only language I had to think in, I'd think functional programming was a bad idea that didn't scale, too." A pretty strong image! Their story is interesting: they took a Java project to Scala. It was an incredible improvement. Then Scala became a pain on its own, so they designed their own functional language for the JVM[2] and moved to that. It was the same sort of incredible improvement. The same thing that happened to Java happened to Scala! Ermine, their new programming language, is basically like the core of Haskell adopted to the JVM along with some interesting new features. One thing that really stood out for me is that they have customizable type error messages: they can have type errors that are domain-specific! That by itself probably has a fair amount of value. [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_... [2]: https://github.com/ermine-language/ermine https://github.com/ermine-language/ermine
- lmm 13y agoI have high hopes for Ermine, but it's not (yet) a real alternative to Scala; it doesn't have anything like the maturity, tool support, or library ecosystem. Which is to be expected - it's barely a year old, whereas Scala has been with us for ten years. Scala is far from perfect, to be sure; even ten years in the future I'd expect/hope there will be a better option, whether that's Ceylon, Fantom, Ermine or something else. But right now Scala is in the sweet spot: it's a huge step up from most popular languages, and at the same time it's mature, popular, and java-compatible enough to be a practical choice for many projects. And as someone who does FP in Scala all the time, I'd be interested to hear what you're talking about with your "pretty strong image". (Also I think Scala's @implicitNotFound covers the interesting cases for customizable type error messages, no?)
- thescrewdriver 13y agoI've used Scala for a few years now. The blog post doesn't do a particularly good job of selling Scala despite the best intentions. I would encourage anyone who is interested in Scala to spend some time learning the language and using it, rather than worrying about occasional misdirected criticism which the blog seeks to counter. I've found Scala to be very expressive and well suited to large-scale systems. It takes some effort to learn the language, but once you have put in the effort coding in Scala is a pleasure (esp. compared to Java).
- ojbyrne 13y agoI'm not a big fan of arguments based on "its the fault of other people's ineptitude."
- timtadh 13y ago"intellectual laziness of dynamically typed languages" What a claim! What an absurdity! Dynamically type checked memory safe languages (eg. Python, Ruby, Javascript, etc...) enable styles of programming impossible in non-dynamically checked languages. So it certainly isn't the users who are being "intellectually lazy." Nor are the creators, who have focused on productivity and usability instead of waiting for proof systems (static type checkers) to catch up with their ideas. Laziness doesn't factor in on either side.
- ionforce 13y agoProvide an example where such a style would be deemed useful or superior to doing it the statically checked way.
- LeafyGreenbriar 13y agoDuck typing in dynamic languages can allow you to do some pretty cool things.
- Peaker 13y agoThe request was for some examples of the claim. You just repeated the claim.
- lmm 13y agoCompared to Java? No question. Compared to Scala with its implicits and associated patterns? I've yet to see a case I couldn't handle in Scala.
- deleted 13y ago[deleted]
- taeric 13y agoAn in place and efficient quick sort? :)
- rch 13y agoI know of two new businesses using Scala in Boulder. That's been enough to put it back on my radar.
- eternalban 13y agoUltimately, every language is simply a tool and they all have their issues. I'll admit that I pegged Scala as "C++ for JVM" when it first came out, but am not a hard headed man. Q to the op is what is the turn over of your dev team? Please provide a defense of Scala in terms of economics of development (from a business pov). Items to address are maintaining the codebase after the whiz kids have left for more exciting pastures.
- frowaway001 13y agoNurturing, retaining and hiring competent developers ... that's probably vastly simpler with Scala than with Java-enterprise-patterns-EJB2 stuff.
- porlw 13y ago"The biggest issue with Scala’s perception is the deeply varying quality of frameworks and tools that significantly affect one’s perception of the Scala language itself" I've seen the same thing said about Common Lisp.