

Choosing Scala - mynegation
http://teaching.software-carpentry.org/2013/11/28/choosing-scala/

======
leokun
I don't come from a CS background, but I have been programming professionally
many years and recently got started with Scala. I had tried Go before and I
like Go. I also really like Scala.

Scala requires much more work to learn than Go. I don't think I ever ventured
out much from the offical Go documentation, the spec and effective Go and the
library documentation to learn Go. With Scala I've already bought 3 books, and
have bookmarked nearly 100 sites. I frequently have very many tabs opened with
various scaladocs, examples and stackoverflow questions open.

My favorite thing in Scala is Akka. I quite like Akka and I like the
functional programming that's possible with Scala. The build tools, like sbt
require getting used to but I'm able to pretty much get along just fine
without an IDE. I do have intellij open but I hardly look at it. I do all
coding in vim and testing with sbt.

About 14 days in and I can connect to TCP and parse JSON ok. That's where I'm
at. There have been some pretty frustrating moments, mostly dealing with 3rd
party libraries (like scalaz, not documented much) and sbt, but once overcome
it feels rewarding.

My other favorite things in scala: it has a REPL, s"String $interpolation" and
pattern matching.

~~~
mark242
Having worked with Scala for the past almost two years, I can tell you this:
you're missing out by not using IntelliJ. It is a huge timesaver, not just
from the code completion or the inspections, but also by being able to fire up
FSC outside of IntelliJ and have your code recompile very, very quickly when
you make changes. The one thing that IntelliJ doesn't do very well yet is work
with sbt. It works, sure, but the maven support in IntelliJ is that much
further along, so I generally still use maven for in-IDE dependencies, and
then write up an sbt file when I publish my work.

~~~
ayosec
> being able to fire up FSC outside of IntelliJ and have your code recompile
> very, very quickly when you make changes

I guess that you can achieve the same benefits with an always-open SBT
console.

I usually do

    
    
      ~ test
    

So SBT will recompile and launch test after every :w in VIM

------
mynegation
Coming from CS and computational math background, I used mostly C++ for
production and Python for prototyping and data analysis. I wanted to learn
some new language for JVM, Clojure and Scala being the main (if not the only)
contenders. I may learn Clojure anyway, but what tipped the scale to learning
Scala first was wonderful Coursera course in functional programming by Martin
Odersky, using Scala as a language, obviously.

A very short summary of my impressions from Scala: * It is beautiful, I felt
the half-forgotten beauty of functional programming once again

* Scala worksheets (quick scratch to evaluate whole code snippets with immediate feedback) are awesome. I love them even more than REPL (Then again, I love IPython notebook more than Python REPL too)

* Scala seems a bit heavy in terms of number of concepts

* Scala can be terse and very expressive, but pretty verbose if you need it to be

* Compilation of large programs is slow and eats gobs of memory

* tail-call optimize everything

~~~
rz2k
Are you aware of the follow-on course?

[https://www.coursera.org/course/reactive](https://www.coursera.org/course/reactive)

~~~
mynegation
Yes, I am following that course, thank you! Although due to crunch at work I
am not doing assignments for this one.

------
dyadic
I really wanted to like Scala, I came to the language looking for a Haskell on
the JVM, but then just found it sacrificing too much, mainly for Java
compatibility.

The close compatibility with Java does allow an easy transition for Java
developers, but it's a transition to writing what it repeatedly deemed
unidiomatic Scala by the Scala community. And then I've seen the same
community scoff at unenlightened Scala developers that are writing "Java++".

Half of Scala could make a really nice language, but the complexity of the
full thing is not something I want to work with again.

~~~
bad_user
You call it sacrificing, I call it awesomeness. Scala achieves the best
marriage between OOP and FP available. If you come from Haskell, you can view
that as a sacrifice, of course. But I don't, to me that's a strength.

Scala is not Haskell and Haskell is not Scala. If you use one and expect the
other, you'll be disappointed.

------
kvtrew76557
As a software engineer I find Scala to be a very powerful tool, but one which
takes some time to learn. I could see it being a useful teaching tool if they
stay away from obscure corners of the language. I'm glad that they didn't go
with Java, but I'd only go with Scala if the students are a sharp bunch.
Python would also have been a suitable choice.

~~~
sampo
> _" I'm glad that they didn't go with Java"_

That School (Aalto University) has used Java as a first year language for
quite some time. Then they switched to Python (I think), and then to Scala.
Before Java, it was Scheme. Before Scheme, I don't know.

~~~
yelnatz
My university switched from Java to Scheme (Racket) for their first year
language.

I'm not sure why they're trying to scare the poor first years away.

~~~
parasubvert
I think Scheme is a good second year language, which is really when The Fear
should set in among the uncommitted.

------
saryant
My alma mater recently switched to Scala for its intro courses, my undergrad
thesis mentor really pushed for it and has written an intro textbook using
Scala. He's also the reason I used Scala for my senior thesis, which led to me
suggesting it at the startup I work for (first hire) and Scala becoming the
basis of our backend.

I think the OP really nails the reasons Scala makes sense as an intro
language. Students can start with simple concepts and gradually see how these
lead to the complicated stuff.

------
agentultra
I really want to understand what the fuss is about with Scala so I fired up a
REPL and found a tutorial and went to work. Then I can across this:

    
    
        scala> print("5" + 5)
        55
    

And I stopped there (for now). At least my C++ compiler will warn about that
(although it will still compile even if it doesn't print anything save for the
newline):

    
    
        #include <iostream>
        using namespace std;
    
        int main(int argc, char *argv[]) {
            cout << "5" + 5 << endl;
            return 0;
        }
    

Python gives me a TypeError. And so does Common Lisp. I was expecting the same
from Scala; a language which purports to be a multi-paradigm language with
static type inference and a strong functional programming bias. Not even a
warning.

What's the reasoning behind this in Scala?

~~~
modersky
Scala inherits essentially all its expression syntax from Java, including the
string +. This was done because a lot of other things in Scala are new, so we
did not want to rock the boat too much with changes that might seem arbitrary.
That said, I believe string + is probably the most criticized feature in
Scala's expression syntax. People are generally moving away from it, towards
String interpolation, which is available from Scala 2.10.

~~~
noahmarc
Thanks for joining the discussion. Just want to say I'm working through the
the videos for your coursera course
([https://www.coursera.org/course/progfun](https://www.coursera.org/course/progfun))
and, in addition to being a great introduction to Scala, it's changing how I
approach other functional languages like JavaScript and R

~~~
mercurial
At most JavaScript is an imperative language with functional flavour

~~~
klibertp
Try LiveScript: [http://livescript.net/](http://livescript.net/)

JS semantics are those of a functional-oop language. It lacks a few standard
functions (LiveScript has prelude-ls) and a ton of syntactic support for
things. Once these are in place, you can write the code which looks and feels
like Ocaml.

For example, moment.js function is `moment(dateString, formatString)`. In
LiveScript I used it as:

    
    
         parseDate = (flip moment) "DD/MM/YYYY"
    

Now tell me that this doesn't look like functional code :)

(The only really lacking feature in JS is of course TCO, but then Clojure, so
yeah, let's just trampoline everything.)

------
eranation
If anyone wants to get a taste of Scala, and don't want to install anything, I
created [http://scalatutorials.com/tour](http://scalatutorials.com/tour), (no
sign up, no installation, 100% free and open source) with syntax coloring and
lightning fast execution of code (thanks to scalakata.com, and Scala's
presentation compiler) If it looks familiar, I was a "bit" inspired by the
"Tour of Go"

------
dkhenry
All very good reasons to use Scala for teaching. I think you will also find
that those students who really get it will sink there teeth in deep and not
hit the bottom of the language any time soon. Thats good for those kids in the
class who are comming into the university with programming experience. I know
when I was doing my introductory programming classes I spent more time trying
to figure out neat things I could do with C++ and Java then actually working
on class work.

------
_random_
C# and F# would also be decent choices former being further in and the latter
farther from abstract C-like comfort zone.

~~~
agumonkey
I see more and more F# on my twitter feed, it seems a very very nice language,
terse, expressive and pragmatic.

psedit: I can't resist one of my favorite f# article
[http://blogs.msdn.com/b/ashleyf/archive/2012/01/26/hp-35-mic...](http://blogs.msdn.com/b/ashleyf/archive/2012/01/26/hp-35-microcode-
emulator-in-100-lines-of-f.aspx)

also, arrayForth chip emulator :
[http://blogs.msdn.com/b/ashleyf/archive/2013/09/21/chuck-
moo...](http://blogs.msdn.com/b/ashleyf/archive/2013/09/21/chuck-moores-
creations.aspx)

------
eklavya
I really want universities here to pick up Scala as well. You can teach all
aspects of modern programming paradigms using it, while retaining real world
applicability and the wonderful JVM and it's ecosystem.

I use typesafe stack and it's really, really good.

------
room271
I use Scala in my job and, though I never formally studied CS, I would be
concerned at using it for an introductory course at university.

Scala is fundamentally a pragmatic language - it is about compromise between
functional purity and JVM/Java-style (OOP-based) mutation. As such, it's hard
to really identify the distinctive features of either because Scala is so
liberal in what it allows.

I wonder whether students would be better off learning something like Haskell
along with (e.g.) Python or Java. And of course a Lisp of some kind(!).

------
francis-
Before you think about using scala watch this:

[http://www.youtube.com/watch?v=TS1lpKBMkgg](http://www.youtube.com/watch?v=TS1lpKBMkgg)

~~~
asdf1234
Paul could do a similar talk for basically every mainstream language. Better
not learn anything!

