Why Scala is the ultimate teaching language

May I answer this question from my experience? I was already a programmer with 30+ years experience. I had used C, Python, Perl, shell, and OCaml, but primarily Lisp and Scheme. I had also read two or three books about programming Scala, and had worked many Scala exercises (on codilty.com) where the dev environment was already given and I just had to fill in the missing function content.

The first time I wanted to write a Scala program to do something real, I had a huge body of code in Common Lisp, and I wanted to experiment with Scala with some of the algorithms already implemented in Lisp to see if they were faster or slower to develop and the run. I expected I could just create a file.scala in the same directory beside the lisp file.

I tried to create it with emacs (being a 30 year emacs user) using emacs scala mode, but this was a disaster. The emacs Scala mode is for expert-expert-expert Scala programmers, not beginners who don’t yet know the Scala language. To use emacs-scala mode you have to install Ensime which depends on swank, but the Ensime version of swank is not compatible with the version of swank I was already using for other things.

So I decided to bite the bullet and use IntelliJ. It forced me to create a huge directory structure that I didn’t understand, and use sbt (I didn’t know what sbt was). There was something vague called a project which I didn’t find any definition of. There happens to be a directory named project which turns out NOT TO BE the project directory. And I had to import the project directory into sbt. This was really confusing. IntelliJ (or maybe sbt) also created lots of hidden directories and xml files which showed in my version control manager. I didn’t know whether to add them to my .gitignore file, or whether they were files I needed to version control.

It took me about a week or 2 before I could finally convince IntellJ to show me the play button, because the Scala file was always in the wrong directory or because I needed to re-import into sbt, and there wasn’t a function called main with the correct type signature in the correct Object definition. It took several months before I could convince IntelliJ to play the scratch file.

Once it finally worked, IntelliJ was great as it showed me lots of things I was doing wrong. It was worth the fight, but it was indeed frustrating and there were a huge set of obstacles before .

The thing that was EXTREMELY helpful was all the knowledgable and helpful people on users.scala-lang.org, who kindly and patiently answered 100s of questions, without calling me an idiot even once, which would never have happened on other internet forums.

8 Likes