Total beginner to programming & Scala, what would you suggest to get them started?

Not such a bad idea ,I would suggest ‘http://learnyouahaskell.com/’ almost everyone new to FP will find the concepts easier to go through via this book, than looking at the code of Cats/ScalaZ. e.g. if you look at the Tree implementation in ScalaZ, its probably easier to understand the concept by looking at the original Data.Tree in Haskell.

Here are some of the best Scala tutorials and books for beginners.

I am also a Scala beginner, with Java background.
I started with IntellIJ IDE. I installed Scala plugin for IntelliJ, and I can straightaway create a new Scala project, with IDE taking care of sbt. I faced no issues whatsoever regarding sbt. I just concentrate on my Scala code.
Hence, thinking what issues one faces regarding sbt?Am I missing something here?

2 Likes

There’s two different issues. Programmers who are beginners in Scala and using Scala as a first programming language. I came to Scala from C#/ Visual Studio. I’ve always used Eclipse as my main work horse. Although I now edit in Eclipse and use sbt with ScalaFx and Revolver / sbt and scala.js on auto fastParse. I remember the overwhelming sentiment in the C# community was: Were’ not here because we have any love for Microsoft, but because Visual Studio is such an awesome tool.

So I recommend using Scala Eclipse. Yes its not perfect, but the improvement over when I first used it is huge. If the Scala community is serious about making it easy for beginners then Scala-ide should be a priority. No not all programmers use IDEs but a very large percentage do.

As for Scala as a beginners language. Its fine in an academic setting, but can Scala seriously compete with HTML, CSS JavaScript, PHP and Bash, for learning something with immediate usefulness? I would love to see that happen, but at the moment just competing with Python is a major challenge.

Competing with Python, for any language, is a major challenge. It’s one of the most popular languages out there. I am with you that we should focus on more on the Scala experience, and I can tell you that there’s progress on this area.

For Scala beginners coming from non-JVM languages, I highly recommend the following resources:

  1. https://scalabridge.gitbooks.io/curriculum/content/ ; Fun. I’ve experienced from first hand how high quality this guide and the “Creative Scala” book are when I was organizing an ScalaBridge in Copenhaguen, hosted by Klarna.
  2. https://www.coursera.org/learn/progfun1 ; interactive, assumes a little bit more of background, but a must for any Scala developer.
2 Likes

Languages are always torn in different directions. Tooling generally gets better, which can help novices, but languages generally get more complex, which hurts them. I’ve been teaching novice programmers to code using Scala as the first language since 2010. Compared to Java it is great, though there have been some minor changes that impact the intro programmers. For example, you used to be able to just call readInt and readLine. Now you need an import to do that. This doesn’t sound like much until you consider a situation where you are trying to maximize what students can do while minimizing the number of language constructs that have been presented. Now I have an extra language construct that I have to talk about in order to do basic input.

Honestly, I view Scala as a statically typed Python for the intro programmer. Part of that is because I use the scripting environment with a basic text editor in CS1. The fact that so many schools are starting with Python these days frustrates and scares me. I worry that we are going to have a generation of programmers who are picking up really bad habits in dynamic typing. Then they spend their careers avoiding static typing because they feel “constrained” by it when often the constraint is the language trying to force them to not do things poorly.

In the second semester, I’ve long used Eclipse as the primary programming environment, and I’m still happy with it. This year I’ve added sbt to the toolchain though. My CS2 class includes elements where I use outside libraries like graphics (ScalaFX) and parallelism (Akka). I’ve given up on having students manually add JAR files to their build paths. I wish that the integration of sbt with Eclipse was a bit more seamless, but so far this seems to be an improvement on what we had been doing.

1 Like

If you’re trying to minimize the number of language constructs presented to your students, have you considered writing a package object with aliases and some “extensions” so that your students only have to do one import?

The construct this forces me to introduce is import, and I already only have one of those for the first half of the semester. Previously I could go through the first half of the semester, which includes expressions, basic types, conditionals, functions, sequences, and loops using basic text input and output without having a single import, so I never needed to show them that. The language keywords they needed were val, var, def, if, match, for, and while.

In the second half of the semester we do files and GUIs (with ScalaFX). I used to introduce import with the files, and they are heavily used for the GUIs. Once we get there, I don’t want to hide them in a package object because they need to know where to look in the API to find things, and having students write imports helps solidify that in their minds. I will also note we are writing scripts, so anything that isn’t in the standard library imposes a hurdle.

1 Like

Generally my priorities for improvement seem to be in sync with the community and the developers. However one thing I would really like, that I don’t see mentioned is composable imports.

What is a composable import?

Something along the lines of:

myGroup = packageA._ ++ packageB._ ++ packageC.{method1; method2}

Then I can just do one import:

import myGroup._

And then to be able to do

myLargerGroup = myGroup ++ packageD._

As I understand it, there’s no way I can do that at the moment.

This is being discussed in https://github.com/scala/scala-dev/issues/474, but the feature is presented in another way. I left there some comments on the export feature as it’s currently envisioned.

1 Like

Hey Mark! I think @som-snytt has contributed a compiler flag (-Yimports) which may be useful to you if you want to import a lot of stuff to avoid explaining the concept of imports to students. https://t.co/G59HMng8gb

1 Like

Thanks for the heads-up. I’ll have to keep an eye on this. I have to make sure it works in the scripting environment, as that is what we use for CS1. Having the scripting environment is extremely helpful for the introductory level.

1 Like

I’m the author of this playlist https://www.youtube.com/playlist?list=PLJGDHERh23x-YBJ8LmYU_IGBFflvsKfLu in which I pretty much jump straight into SBT. So far only positive feedback… Honestly as a beginner you barely have to touch SBT. Zero configuration is required in the beginning, you can create .scala files in the root of your project and don’t need to know about src/main/scala and all you need to know is how to compile and run your code. I’ve never met a beginner struggling with SBT. It’s only advanced users who feel the complexity of SBT when they start playing around with the config.

1 Like