9 ms·
Why Learn Scala in 2013?
- ddw 14y agoFunny, I had already planned on this as a 2013 goal of mine - this blog post only reinforced it! Coursera has a Scala course from Odersky that's worth giving a shot: https://www.coursera.org/course/progfun https://www.coursera.org/course/progfun
- virmundi 14y agoI've looked at Scala. I think it's really neat. I think it is Perl. And that's what scares me. You can solve the problem in many ways, each one getting more functional and abstract. Eventual so abstract that you can't really tell what going on. Another issue is the fact that it interacts with the JVM. Short answer, it seems nice, but if you're functional, you can't really use the 3rd party libs because you can't be sure they will play well in the functional world. Long answer is here. http://talesfromannoyance.blogspot.com/2012/05/why-im-looking-at-erlang-over-scala.html http://talesfromannoyance.blogspot.com/2012/05/why-im-lookin.... I'll probably double back to Scala at some point, but I think a language off the JVM is a better option. Or at lease one that is so odd to the JVM that most people will only look for libs written in that language. For that I assume Clojure is a better choice.
- CCs 14y agoThere's no limitation: you can use any 3rd party Java library from Scala. We do it in production for years, works perfectly. It's true that Scala DSL is scary. As far I know soon (version 2.10?) you will have to add a compiler flag to enable some scary stuff. They are useful for library developers, but not too great for everyday apps. Also you don't have to use the functional part. I saw plenty of code that looked like a nicer Java. You get less boilerplate and better performance - see http://news.ycombinator.com/item?id=2615096 http://news.ycombinator.com/item?id=2615096 Edit: The article you linked says: "... one call to some open source project that didn't worry enough about threading to even warn the user that the object is not thread safe." This would fail in any language, including Java.
- virmundi 14y agoYou're right. But functional adds a whole new layer of "safety". The functional developer will think, "My code is functional, share nothing, messaging passing goodness. I'm fine." As but some new developer, keen on Scala, but not thinking about the older 3rd parties, adds a call from his functional goodness to the non safe, side effecting code. This will introduce a subtle, hard to trace bug. As a result, I'm not a big fan of the "it's compatible with Java" hype around these VM languages.
- donjigweed 14y ago> I'm not a big fan of the "it's compatible with Java" hype around these VM languages. The fact is Java interop is a fundamental feature providing great pragmatic utility as well as an absolute prerequisite for any kind of adoption of these languages. It's basically the opposite of "hype."
- virmundi 14y agoI don't agree. I think that interopt should be at a higher level, like services. Putting the ability to integrate code not written for your paradigm is problematic. Pragmatic, but still problematic. It's a lot like Node.js. Why Javascript? Because it is so self contained that it is impossible to use code that violates the paradigm because its too new. When the designer of Node looked at using straight C or another language, the legacy threat put him off. Same thing here.
- donjigweed 14y ago> I don't agree. I think that interopt should be at a higher level, like services. Putting the ability to integrate code not written for your paradigm is problematic. Pragmatic, but still problematic. I think if you look at just about any common example of idiomatic Clojure code you'll find Java interop sprinkled all over the place. People aren't going to reimplement all those libraries in Clojure, Scala, or whatever other JVM lang you're targeting. Seamless interop is a prerequisite. I think most Clojurians feel it yields far more benefit than any problems it might introduce.
- eli_gottlieb 14y agoI had a job where we needed Java interop but wanted to do functional programming. The whole team ran on Scala, of course. I hate to speak the Word of Curse, but this was why we used monads. They gave us something of an effect-typing system in which to wrap calls to side-effecting third-party libraries.
- sramsay 14y ago"I've looked at Scala. I think it's really neat. I think it is Perl." Or C++. Brilliant programmers will undoubtedly do brilliant things with it, but for a lot of folks, the word "multiparadigm" might as well read "radioactive." It's true (as someone above noted) that you can use a useful subset of the language and discard the rest, but weak programmers seldom choose correctly, and so we're left with steaming piles of spaghetti everywhere. Ten years ago, I would have been thrilled reading Odersky's book. Nowadays, I die a little inside every time I see the phrases "language feature" and "syntactic sugar" in a language manual.
- g2e 14y agoCan anyone recommend a good book on Scala? Or should the documentation be enough?
- Garbage 14y agoProgramming in Scala - http://www.artima.com/shop/programming_in_scala_2ed http://www.artima.com/shop/programming_in_scala_2ed For more links, visit http://typesafe.com/resources http://typesafe.com/resources
- gtani 14y agobesides staircase book (the one from Artima.com: the other good starter book: http://horstmann.com/scala/ http://horstmann.com/scala/ detailed looks, all angles: http://www.manning.com/suereth/ http://www.manning.com/suereth/
- CCs 14y agoTalks, videos, other resources: https://www.assembla.com/spaces/liftweb/wiki/Resources https://www.assembla.com/spaces/liftweb/wiki/Resources
- justin_hancock 14y agoBruce Eckel is releasing a book this year on Scala, Atomic Scala: http://www.atomicscala.com/ http://www.atomicscala.com/ Eckel's Thinking in Java was a classic, I suspect he will this one out of the bag too. The Odersky book is good as a reference, but not a great teaching tool, its too big. I watched the video lectures, they're quite good if a little dry and occasionally quite abstract especially if you're trying to apply Scala to real world problems. Be warned though interop isn't perfect between Java and Scala, sometimes you have to resort to tricks to make things work, Hadoop APIs being a good example.
- fasouto 14y agoI recommend Programming in Scala: A Comprehensive Step-by-Step Guide http://www.amazon.com/gp/product/0981531644/ref=as_li_ss_tl?ie=UTF8&tag=ninja0ed-20&linkCode=as2&camp=1789&creative=390957&creativeASIN=0981531644 http://www.amazon.com/gp/product/0981531644/ref=as_li_ss_tl?... Clear and well written.
- jballanc 14y agoWhen I first encountered Scala, my impression was that this would be Java 2.0. Two plus years later, that's still my impression. What this means to me is that if you are looking for a new work-a-day language (i.e. the language that you use to pay the bills; the ones that appear in the Tiobe top 25), then Scala is probably worth a look. However, if you are happy with your current working language and are, instead, looking for a language that will let you grow as a programmer...well, for that sort of approach I'm not so sure Scala is the best you can do. This is just anecdotal, but I've noticed a trend where someone does something cool in Haskell, and then says "oh yeah, and with a few adjustments and given a couple of caveats, you can do it in Scala like so...". In other words, it seems to me that more of the innovation is happening in other languages and then its being brought back into Scala as almost an afterthought. I have seen some hints that this is changing, and so I definitely won't write-off Scala. At the same time, there are an awful lot of interesting languages out there if you're looking to grow as a programmer...
- noelwelsh 14y agoI think it's true that Haskell is better for playing around with the stuff published in ICFP and related conferences. The reason, however, is a bit more subtle. Haskell is the dominant language for programming language research. So publications tend to use it, and Haskell is better adapted at being Haskell than Scala :) There is also more stuff being published in Haskell for this reason. However it is not correct to say that Haskell is more expressive than Scala. It is in some ways but Scala is more expressive in others. There is a paper that discusses type classes in Scala and show they have some advantages over Haskell's implementation. As more people use Scala and discover neat things you do in it, this is feeding back into other languages. For example, here's the mighty Oleg implementing the cake pattern from Scala in Haskell: http://okmij.org/ftp/Haskell/ScalaCake.hs http://okmij.org/ftp/Haskell/ScalaCake.hs
- seanmcdirmid 14y ago> Haskell is the dominant language for programming language research. ..... There is also more stuff being published in Haskell for this reason. No. Even if you just mean the FP (functional programming) community this isn't true, and it's definitely not true for the whole of SIGPLAN.
- ww520 14y agoI haven't looked at Scala lately. Has the compile speed of Scala improved? Is it comparable to Javac now?
- karterk 14y agoNo, it's very slow. If you use a SSD, it's manageable.
- yummyfajitas 14y agoOne thing I've found helps a LOT is encapsulation and return type annotation. If you change a public method, SBT will recompile all users of that class even if they don't use that method. If you change a private method, it's smart enough to recompile only the one file. Annotating your return types both saves the compiler the effort of figuring out what you meant, and also prevents you from accidentally changing the return type and forcing recompilation of a bunch of client code.
- CCs 14y agoThe new SBT is a lot smarter now, my incremental builds are pretty fast. Speed-up is part of the roadmap: http://blog.typesafe.com/getting-down-to-work http://blog.typesafe.com/getting-down-to-work
- ryanpers 14y agoIt's too bad sbt isn't actually simple and is generally a disaster. I did scala in IntelliJ. The lack of tooling reduces the value a lot. I almost prefer plain java over the sheer simplicity it has comparatively...
- CCs 14y agoI tried IntelliJ, but the Scala plugin had a lot of bugs. Eclipse on the other hand is pretty good now: http://scala-ide.org/ http://scala-ide.org/ Personally I find the SBT Scala file much simpler than a Maven XML.
- TeeWEE 14y agoI really like Scala. But i have some thoughts on this article: - Its not objective: It's from Typesafe. Logically they are not going to mention the negative sides of Scala I used Scala myself and I think it is a very good approach to combining functional, imperative, object oriented and type safety in one language. But the big downside is complexity: Scala is utterly complex, its has all the features of java. But it simplifies the object model (everything is an object), that's a good thing. But the type system? Really complex. Making compile time errors very difficult to understand. A shift to functional style programming is happening more and more. But I think, and hope, there will be a complete paradigma shift from imperative to completely functional. This should start with universities starting with lambda calculus and functional languages to 1st year CS students. Functional programming has the simplest execution model, is one of the best to reason about, and works very well with current multicore systems. That's why i'm spending more time on learning Clojure than learning Scala. In the end a language like lisp is much simpler but the paradigma shift is what makes it a bit difficult for those imperative programmers like me.
- karterk 14y agoI'm not disagreeing about the complexity, but you can choose to use a sane subset of the language and do away with all the other stuff. Map, filter, anonymous functions and type inference already puts it way ahead of Java in terms of productivity. You can absolutely choose to ignore the rest of the language. In the end a language like lisp is much simpler but the paradigma shift is what makes it a bit difficult for those imperative programmers like me. It's not very fair to compare Scala with Clojure - static typing might not be everyone's cup of tea, but over time, I have come to appreciate it's power when dealing with certain classes of problems.
- abolibibelot 14y agoI'm not disagreeing about the complexity, but you can choose to use a sane subset of the language and do away with all the other stuff. You're aware that's the classic counter-argument to "C++ is too complex"? Like with C++, the problem is it will be very hard to agree on what sane subset to use. There are a lot of things nice about Scala, but I can't help seeing it as the C++ of FP languages. Moreover, the Haskell envy it exhibits can be sometimes embarassing.
- mcartyem 14y agoCan anyone explain in less than ten words why one should learn Scala in 2013?
- CCs 14y agoFoursquare, Twitter, LinkedIn, Netflix, Box.com, Nest.com, CloudPhysics, Quora, Simple, Klout More than 10: http://www.quora.com/Startups/What-startups-or-tech-companies-are-using-Scala http://www.quora.com/Startups/What-startups-or-tech-companie...
- mdellabitta 14y agoTumblr too.
- mcartyem 14y agoAre you suggesting that the metric of how powerful a programming language is is the quantity of companies using it?
- clavalle 14y agoPowerful? Perhaps. Useful? Definitely.
- bretthoerner 14y agoYou're the only person in this thread who said the word 'powerful'.
- CCs 14y agoHe was asking: why should he learn Scala? Getting hired by any of these companies can be a good enough reason for some.
- dbecker 14y agoIf you ask for an explanation in 10 words, you shouldn't complain when it doesn't address all your concerns.
- 14y ago
- dkhenry 14y agoWhile I don't think _this_ article presents any compelling reasons to learn scala, you still should. If I had to list my reasons they would be 0. Of all the "new" languages Scala has the best selection of libraries and I think is the easiest to become instantly productive in. Languages like Rust and even to some extent Go are also really exciting and let you do great things, but the native library support isn't as robust as it is for Scala, and Rust in particular is still under heavy development and isn't really ready yet. From a stability standpoint you should be OK with Go, but even it will be baking in more stuff and changing more then you will see Scala change. 1. The Productivity Boost Effect. You will find you can solve complex problems with a few lines of code and a little thinking. I have ported 1K+ lines of C++ to 10 or 20 lines of Scala 2. Personal Growth. If you are coming from C++ or Java and have done Imperative programming your whole career then Scala is a _gentle_ introduction to functional programming. As you start to use the language you might start by using it as java and only typing half the character ( no type signatures ,semi-colons , or in some places parentheses ) as you do more things and look for elegant solutions the function patterns will become obvious in their usefulness and you will start seeing their value first hand. 3. Awesome Libraries you get access to. I think immediatly of things like Akka, Twitter Storm , Play2 , and my personal favorite Spark[1]. Not that there aren't great libraries in other languages and most if not all of those expose themselves to Java and other languages, but its great using the native language they were designed for. you can do some great stuff. 4. Finally its better then spending all day reading and commenting on Hacker News. :-)
- apl 14y ago> I have ported 1K+ lines of C++ to 10 or 20 > lines of Scala I'm not doubting your claim, but as a general rule that sounds awfully steep. Maybe you got lucky (because whatever you wanted to do was a brilliant match for some standard library function or happened to be tailored to a uniquely "Scala-y" feature). In most cases of drastic code reductions upon language switch, however, it's one of two phenomena: a) Rewrites are usually more succinct simply because you've done the legwork before; a second solution is almost bound to be more to the point. b) One wasn't using the initial language properly. Sure, going from C to Haskell may lead to insanely compressed code, but C++ in conjunction with its mature standard library, Boost, and the multitude of libraries available is such an advanced and excessively paradigm-spanning language that a reduction by not one but two orders of magnitude suggests a less than perfect first draft.
- ishbits 14y agoIts Scala or Go in 2013 for me...
- karthikeleven 14y agoJava 8 (coming out in 2013) is going to be sprinkled with functional programming features....
- pohl 14y ago...with emphasis on the sprinkled. No partial function application, for example.
- charlieflowers 14y agoAnybody have any knowledge of how job prospects compare between Scala, Clojure and Haskell? The article seems to imply Scala jobs are taking off (19 pages). Are Scala jobs really outpacing Clojure and Haskell?
- arikrak 14y agoScala seem to have much more job results on every site than Clojure and Haskell: http://www.simplyhired.com/a/jobs/list/q-scala+developer http://www.simplyhired.com/a/jobs/list/q-scala+developer. See also Dice.com. To see startup jobs, check Startuply or Angel.co: http://www.startuply.com/#/scala%20developer/1 http://www.startuply.com/#/scala%20developer/1 (To get more accurate results, you should search in-title or by tagged skill.)