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

A recent Twitter poll by @scala_lang (https://twitter.com/scala_lang/status/826072310436204546) led to some interesting discussion about how to best serve Scala beginners. As suggested by @heathermiller, moving the discussion here.

Here’s my two cents: Simply download Scala and play around in the REPL. Setup is easy. In the REPL feedback is immediate, it’s more conducive to experimentation. There’s no concern about how best to organize code or worry about resolving SBT/dealing with network issues/etc. Pair this with a decent interactive tutorial (like scala-exercises.org) and I think that’d be a good first step for a newbie.

I went back and forth about SBT but it seems cruel and unusual to add any more concepts than simply run and evaluate scala code. SBT is a natural next step though.

2 Likes

First of all : https://www.manning.com/books/functional-programming-in-scala . I’m reading it ATM and it’s really good.
Then I’m following Coursera’s https://www.coursera.org/specializations/scala and I have to admit Odersky’s courses are really nice to attend :slight_smile: (by the way the courses themselves are free, you just need to pay if you want Coursera to stamp your LinkedIn account once you’ve completed the assignments).

2 Likes

Also one of the simplest ways to start Scala is ScalaFiddle https://scalafiddle.io/
You don’t need anything to download or install. It’s so very convenient :slight_smile:

4 Likes

I think you should give beginners a foundation they can build on, which means real tools, which means a text editor and sbt-extras. The “sbt is too hard” argument is valid but the solution is to make sbt easier, not to coddle beginners and leave them stranded in an environment nobody actually uses for writing Scala programs. I wrote a grumpy blog post some time ago with my thoughts in more detail.

1 Like

I agree that scalafiddle.io and scala-exercises.org are nice ways to try the language for curiosity’s sake.

Also, the simplicity of the REPL is really nice. What if for beginners, we suggested just using IntelliJ to create a new Scala project (without SBT) and from there use Scala worksheets? Then you get the instant feedback like the REPL but the code gets saved.

Once you’re ready to build a real Scala project, IntelliJ with SBT is a slick all-in-one environment. You just have to figure out where in the directory structure the Scala code actually goes :slight_smile: and what all the other files and directories are for.

1 Like

I would start with an online platform such as scalakata (or Scastie, stay tuned). When we got their motivation built up, we can guide them to work on their own computer. I assume most of the traffic would be from Windows and Mac users. It would be nice to provide them with an easy installer (Scala.msi/Scala.pkg) that bundles intellij with the scala plugin, sbt and openjdk.

1 Like

If beginners want shallow learn language i advise scala-exercises for learn basic syntax + online editor for experimenting scalakata/scalafiddle (both have very nice autocomplete). It’s allow very fast start and easy introduction into lang.
If beginners wants more seriously learn language i advise book “Scala for impatient” and IDEA Scala. IDEA have traditional text editor, repl and worksheet. IDEA have tips/warnings which very useful for beginners, because Scala have some legacy feature which considered bad practice (null pointer, <% syntax, implicit conversion ant etc).
P.S. IMHO, i think scala course (Functional Programming Principles in Scala) not best for novice, it’s very oriented for functional paradigm and may very complicated + course marked as “Intermediate” level. It’s can scare novice. I think better course or material which show difference between imperative and functional paradigm without sacrifice both.

1 Like

I’m a fan of Scala for the Impatient, but with a big caveat: it’s a good way to get started if your background is in Java. (Which was its target audience.) But otherwise, not so much…

Yeah, sbt has to happen to noobs eventually, but a gentle introduction that avoid that distraction is important.

Let me put in a plug for using http://sciabarra.com/book/ as classroom posters.

Let’s scope the discussion to the twitter poll question:

If a total beginner to programming & Scala asked you how to download/start with Scala, what would you suggest to them?

  • just download sbt
  • just use IntelliJ
  • other editor + ensime
  • download ammonite

We are also interested about learning material. Maybe we can create another thread about that.

Well, actually the discussion on Twitter asked to move discussions that don’t fit neatly into the 4 choices in the poll to a long-form forum. So I think it’s appropriate to collect various suggestions here. It’s very nice to see what other learning resources have sprung up and which people tend to use nowadays!

So to reiterate, all suggestions welcome for how you would help total newcomer to programming and Scala to get started. Which tools/resources should be the first things these people see?

An opinion or three.

First, I’d say not the REPL. The REPL is fine for one-liners, but a pain to use for even modest multi-line functions. Ammonite is better, but I still think it’s not a good way to get a real sense of Scala.

Something in the general line of scalafiddle.io would be better as a Very First Step – something that allows you to try out real functions quickly and easily. That should be embedded front and center in the website. Better yet if there is an easily-accessible and well-indexed archive of examples you can play with.

I would love to say Scala Exercises, but can’t quite – while I think it’s not bad for the Scala beginner, it does presume some familiarity with programming. I love the tech, though, and I suspect a more novice-programmer-oriented chapter based on it would have real potential.

While I like putting an interactive fiddle tool in front, to make it very easy to mess around, I agree with @tpolecat that pushing people towards sbt as quickly as possible is for the best: we don’t want folks leaning too hard on crutches that will inevitably get pulled out from under them. I think the key initiatives to make this work are in motion – the combination of the Platform and sbt new seem critical – but folks should be constantly testing the new-user experience. It should ideally be no harder than "install this package, and then say sbt new" in order to get a valid (if generic) skeleton project, ready to use with your choice of editor. (Does sbt have an easy-to-use installer?)

Speaking of editors: folks tend to ignore the Scala-IDE, but I think that’s a strategic mistake. Yes, many people are focused on IDEA, but a lot of the engineers coming out of the Java community are used to Eclipse. Making it as easy as possible for them to keep using the tool they know would probably aid that transition, so it may be worth including the Eclipse plugin in the Platform. Give it some thought, anyway.

1 Like

What is the current status of that?

I started out using that, and I left it because of the workflow:

  • start an eclipse project
  • fail to add dependencies
  • try to make the eclipse project into an sbt project
  • fail
  • throw everything away
  • start an sbt project
  • eclipsify the project
  • work in eclipse until it stops working for one or the other reason
  • try to fix the project in sbt
  • re-eclipsify
  • hope it works
  • do things to get the eclipse environment and the sbt environment in sync (environment variables/java version, scala version)
  • ask around
  • nobody uses scala-IDE

Scala-IDE didn’t use to be a solution: realistically speaking your build is going to be sbt based, and keeping your sbt build and eclipse project in sync used to be a non-trivial exercise.

As long as that’s still the case - if it is still the case - Scala-IDE isn’t a good start for new scala programmers IMO.

2 Likes

I have used eclipse and sbt together for relatively simple projects (I’m talking ~30 lines build.sbt, the most complex build being a jvm/js cross project) and that went fine as far as I can remember.

Scala-IDE doesn’t natively support Scala Build Tool. Let’s not inflict that on beginners. I have found when teaching beginners they love worksheets/playgrounds. The repl quickly gets tedious and when you leave a session and come back you have to start over. I also agree that IntelliJ is a big up front request. What I would prefer doesn’t exist, but maybe it should, which is worksheet support in SBT (or maybe ammonite). It would be great to SBT new playground and get a repl open to playground.sc with two panes, one for coding and one for seeing results of your experiments, without needing an ide.

Well, I’m using it for a non-trivial (~50k SLOC) cross-project in-beta product, so it’s certainly not “nobody”. I committed to Scala-IDE back when IntelliJ just plain wasn’t working for Scala.js, and haven’t yet felt much need to switch.

I wouldn’t say that it’s perfect, but it’s certainly not as bad as you’re making it out to be, so long as you understand the workflow. It has only one bug that really annoys me, which is a tendency to forget about my most recent changes. (I don’t yet know whether this is mainly a Scala-IDE bug or an Eclipse one.) It does require picking up the discipline of re-eclipsing when I make dependency changes, which is disappointing in principle but not really much hassle in practice – it’s just something else to do along with reloading my sbt file.

And mind, I’m not saying that we should point newcomers at Scala-IDE as it currently is – the experience is still too rough. And I don’t know if it’s ever going to provide the truly seamless Visual Studio experience. I’m saying that it would be lovely if we could put some more resources behind Scala-IDE to get it to the point of being comfortable for Eclipse-experienced newbies. From what I can see (mind, I use it all day, every day) that doesn’t seem like an unreasonably difficult project…

I should note that I’m starting to consider this to be a design issue – while the two-window IDE+sbt experience is not terrible, it’s notably the clunkiest part of things. When I talk about putting more resources into improving Scala-IDE, this would be my top priority: figuring out a better-integrated experience that smooths some of these pain points. I suspect there are about half a dozen enhancements that would make a world of difference.

(I wouldn’t mind discussing those, but I suspect this conversation isn’t really appropriate here, and belongs on the Scala-IDE mailing list or some such. Anybody know if the project has a Gitter?)

1 Like

What about something like “Thinking in Java”? No kidding. Right now, everyone tends to jump into the chosen language as soon as possible. A while ago people on forums used to suggest learning essentials with C, Pascal or others and later switching to the preferred language. Scala has a lot to offer what makes it too complicated for the newcomers, especially for the ones with no background. Therefore, I think that it would be easier and better for them to start with Java.

Aside from that, I would like to point out scala-exercises: starting with basics, interactive, no need to install anything. Almost as good as try.redis.io.

2 Likes

That book is not bad at all, but that’s not really intended for beginners. From the intro of TIJ3:

This book assumes that you have some programming familiarity: you understand that a program is a collection of statements, the idea of a subroutine/function/macro, control statements such as “if” and looping constructs such as “while,” etc.

If you want to start from something else for didactic reasons, frankly, I suspect How to Design Programs http://www.ccs.neu.edu/home/matthias/HtDP2e/ is a better choice. It’s much better than most other introductory courses, teaches a structured approach to design and as a bonus starts (slowly) with functional programming. While translating from imperative to functional might be hard, they literally start from high-school algebra, and build toward sum and product types, then to recursive types and primitive recursions, and then onward from there.

I have TAed a course using it to a mixed audience including absolute beginners, and my colleagues also used it with 3rd year students who had done some Java.

There really aren’t many resources for Scala that don’t assume previous programming knowledge. I have been teaching Scala for CS1 and CS2 since 2010, and I had to create my own material to do it. That material is available as textbooks (“Introduction to Programming and Problem Solving Using Scala” and “Object-Orientation, Abstraction, and Data Structures Using Scala”) and videos on YouTube (https://www.youtube.com/channel/UCEvjiWkK2BoIH819T-buioQ). For an organized view that associates playlist with chapters you can go to http://www.programmingusingscala.net/. The CS1 book and videos truly assume that you have never programmed before. The CS2 materials ideally build off the CS1 stuff, but they also include an introduction to Scala for anyone with programming basics coming from a different language.

I think that “Atomic Scala” was also aimed at the complete beginner, but I don’t know when it was last updated. The second edition of my books just came out in the last year and all the code was written for and checked with Scala 2.12.

5 Likes