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


#15

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.


#16

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…


#17

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?)


#18

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.


#19

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.


#20

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.


#21

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.


#22

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


#23

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?


#24

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.


#25

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.

#26

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.


#27

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?


#28

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.


#29

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.


#30

What is a composable import?


#31

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.


#32

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.


#33

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


#34

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.