Any plans for making Scala 3 a viable option for learning programming basics instead of Python?

Hi, I’m interested in learning programming and as a beginner who has not programmed before I want the help of Scala’s typesystem to avoid as many of the problems in Python or other dynamic languages has as discussed in Mention teaching with Scala on the Scala website - Material - Scala Teachers , especially Mark Lewis’s Medium articles.

But all books that exist now on Scala 3 assume you already know programming in other language.
The fact that I need to learn programming basics using another language just so then I can come back to Scala is very unappealing for me.

Is there really no effort in the whole Scala ecosystem in onboarding non-programmers into Scala?
I’m one of those people who want to learn Scala but I can’t because all material is made just for people who are already programmers in another language.

2 Likes

Welcome to the Scala community @formlessdao

The closest books to what you are asking, to my knowledge:

Software Engineering from Scratch (but it’s written for Scala 2) This one assumes no knowledge, starts by hand-holding you through installation, even basic computer concepts like file/directory structure and basic Terminal commands, and history of computers and programming languages, even before introducing basic expressions and values on the Scala REPL. You’d have to exert some effort to make it work in Scala 3. Not much effort, but definitely some effort. The author says:

That being said, it is important to note that this is not a book about
Scala. The concepts taught in this book are not meant to demonstrate
idiomatic Scala programming. Rather, the objective is to teach you
software engineering concepts in the most digestible manner possible in
an extremely flexible language that no other language can match.

Creative Scala (again written with Scala 2 but can be made to work in Scala 3) This one is based on the principles of How to Design Programs by those Programming Language Teaching research people, it focuses quite a bit on using images like the How to Code courses. Very colorful and fun. You can do this in 1-2 lines of code:
Screenshot from 2022-10-04 17-20-30

For Scala 3 the best beginner-friendly book is Get Programming with Scala but this assumes some experience with another language such as Java. BY FAR THE BEST and most friendly Scala 3 book. It uses Scala 2 syntax (lots of curly braces) for maximum compatibility (because Scala 3 accepts that) but the code works in Scala 3. You can write the code in a Scala 3/Python style as you go through.

Once you get some basic knowledge and skills, and you’re feeling confident, you can take Martin Odersky’s course. This course starts from basic principles (for example how evaluation works) and goes in depth, but it’s definitely difficult.

My advice: stay away from random tutorials, websites, articles etc. on the web and don’t try to learn from the Documentation (for some reason a lot of people do this, I don’t know why).

You can find me on Discord spamegg#3510 if you have questions.

1 Like

At Lund University we have made open source teaching material in an introductory computer science course available here with a license that works for non-commercial usage:

Pdf: https://cs.lth.se/pgk/compendium
Source: GitHub - lunduniversity/introprog: Teaching material for "Introduction to Programming using Scala" at Lund University, LTH. http://cs.lth.se/pgk/
Course home page: EDAA45: Programmering, grundkurs (Scala) | Datavetenskap

The material assumes no pre-knowledge and focuses on basic concepts in software engineering and computer science as a first year university level course with Scala 3 as the pedagogical vehicle, using this progression: Föreläsningar | Datavetenskap

It’s in Swedish but google translate might help you. Perhaps I will get the energy and free time to translate some of it to English some coming semester, but it’s a lot of work…

4 Likes

Google translate made a fairly good job in translating our progression in lectures:
https://cs-lth-se.translate.goog/pgk/foerelaesningar/?_x_tr_sl=sv&_x_tr_tl=en&_x_tr_hl=sv&_x_tr_pto=wapp

Also the main home page is not too lost in translation:
https://cs-lth-se.translate.goog/pgk/?_x_tr_sl=sv&_x_tr_tl=en&_x_tr_hl=sv&_x_tr_pto=wapp

1 Like

You mentioned @MarkCLewis. I believe he also has some university courses with accompanying text books that start from scratch using Scala. I think he even has YouTube lectures. But we would have to ask him very nicely if he has migrated any of that for Scala 3 already.

1 Like

General programming is often taught in pseudo code anyway. So I would probably start with a primer such as ‘Algorithms and Data Structures’ by Cormen, Layserson, Rivest (sorry if I made a spelling mistake). Learning basics of things like functional programming or object oriented programming can be easily learnt in other languages - Scala’s syntax is similar to that of ML, and its object oriented features are necessarily very close to Java (especially current Java); similarly for concurrency.

The effort in learning programming does not lie in knowing languages, but in knowing and learning how to use ideas those languages implement. If you know basics of ML and Java you can learn basics of Scala in hours, a weekend at most. In general, an experienced programmer needs about 2 days to familiarize themselves with a new language, about a month to be considered competent, and a year to get close to mastering its capabilities (assuming they learn continuously). Better yet, if you can find such a book on Kotlin (and it might be easier as it’s an official Android language), then switching to Scala will be a no brainer - Kotlin has most of the basic features of Scala and Scala has almost anything that Kotlin has.

Also, a word of warning: Scala works well as a first language, but only if you write your own code.
If your motivation lies with learning external libraries, then these can be hard for a beginner, because aside from its elegance in implementing basic concepts, Scala allows to write really advanced and tricky code, which can pose problems even for people working as Scala programers.

Sorry for not being of practical use to you, but if you consider learning programming seriously (as it being part/all of your job), then learn as many languages as you can.

1 Like

Thank you for providing resources you have previously reviewed. This is the type of recommendation I value the most.
Question is how much of the basic syntax used in introductory courses to programming has changed form Scala 2 to Scala 3?
If there is almost no change then I am willing to use those Scala 2 resources you and others mentioned in their posts.
If the changes are large then I will just abandon Scala for now and just learn using Racket.

It’s not on the part of the non-developer to go out of their way and bend over backwards to learn from resources that are not up to date.
Scala 3 was released more than 1 year and 4 months ago. The fact that not even one of the most basic introductory programming basics in Scala materials have been updated so far speaks more about the authors themselves and the fact that they don’t consider Scala a priority when it comes to exposing newcomers to programming itself.
Maybe they also have lost faith in Scala’s future just like a couple of people I’ve seen mention on reddit that they don’t plan to use Scala anymore on new commercial products because either the different sub communities in Scala quarreling, either some maintainability issue OR that they struggle to find Scala developers that are properly trained to use Scala.
I found this mentioned by at least 3 people while I was searching for more info about libraries that are usually recommended and considered mature for different tasks.

Reading this made me sadly loose a significant part of my initial enthusiasm. Sure the language can be great but if I keep reading about unhappiness of long term users of Scala either about maintainability issues in the long run or that they are fed up with drama in the ecosystem …what should I conclude as a guy wanting to learn Scala?

Python is not that great by itself but the humongous amount of data science people who use it(because it’s just the right amount of clear/simple and flexible enough for them) because they just want to focus on their work and not on being programmers made that ecosystem the golden standard, the data science libraries in Python ecosystem are considered always the most mature and cutting edge in almost all cases…some exceptions might exist where a very small number of libraries either in Julia or Scala ecosystem exist that are cutting edge in some data science sub domain.
Julia fixes almost all Python problems but the language itself is not adopted as fast as it should because the data science libraries in it and even the most general ones are not yet mature enough or not well maintained enough by different professors who are not programmers and don’t have the ingrained culture of properly documenting their library so others can use it not just them.
Jeremy Howard in his featured talk in Julia Con 2022 outlined the reasons why he still can’t use it in production yet and why he’s sad because he loves the language itself and would prefer it to Python.
My initial plan was to learn Scala because it’s mature enough, including library ecosystem and call python libraries from inside it when I absolutely need them.

If you’re already experienced with programming sure it’s a piece of cake to just learn new syntax in a couple of hours or in a weekend to try out a programming language you are unfamiliar with.
For beginners like me I don’t have the skills of a programmer to know how to properly separate concepts from syntax…so for complete beginners like me learning another language is not much more different than learning Scala 2…just so I then need to learn the new syntax in Scala 3 and not be confused.
Again…that is until someone can confirm just how many changes there really are between version 2 and 3 that affect me when learning the absolute basics from a syntax point of view

I don’t think the basic syntax differences between Scala 2 and 3 should cause much confusion. unless I am forgetting something (which is entirely possible), most of the syntax changes are simple, intuitive, and optional.

For example, Scala 3 allows braces to be dropped if the indentation is consistent with the logical structure (as it should be anyway). But you can still use braces if you wish. I personally appreciate the less-cluttered look.

An “if” expression is written in Scala 3 as

if a then b else c

as opposed to

if (a) b else c

in Scala 2. Hardly a brain bender! And you can still use the old syntax in Scala 3 if you wish.

Similarly, “for” expressions can now be written as

for a <- b do c

as opposed to

for (a <- b) c

Again, a trivial and intuitive change, and you can still use the old syntax if you wish. I wouldn’t worry about the syntax changes.

You are welcome! Glad I’m helpful :heart:

Not much, should not be an issue. I’m just an obsessive curly braces hater, so I removed all the unnecessary ones like a maniac as I went through the books.

As for the rest of your post… For someone who never programmed before, you seem to be extremely knowledgeable about things that surround languages. You seem to be waaaaay overthinking this stuff and getting all kinds of bad ideas from the Internet. When I was just a beginner, I never went to Reddit or whatever, and I never did any research on language community politics or fights or libraries. But then again I’m kinda old, so I don’t get the current generation and their strange habits (no offense).

Personally I’d say: just ignore all that. Internet discussions aren’t reality. Esoecially Reddit, an extremely awful place (only second to Twitter). They just distract from learning and plant seeds of doubt, fear and confusion in your mind. This seems to be a common mental pattern for beginners: they keep hindering their own learning due to drowning in an ocean of information to sift through.

Secondly: try to think past “this language, that language” kind of thinking. Instead focus on the computer science topics and programming language concepts that are universal and found all over the place. This can be done with many languages: Scala is one, Python is another, and there are many more. You certainly don’t have to use Scala if you don’t want to. Once you grasp the concepts, you can learn and use whatever language/library you want. Your post makes it sound like: you’re gonna fully invest and commit to only one language and its ecosystem. It’s not like, if you start with Scala, you’ll be stuck with Scala forever, unable to use any other language…

Shameless plug: check out this curriculum that I’m involved with: GitHub - ossu/computer-science: Path to a free self-taught education in Computer Science! we have so many beginners that help each other. Here is another great resource that I helped build, directly aimed at beginners (Python): https://futurecoder.io/

You are reading way too much into it. Beginner-oriented resources like Creative Scala were made a few years ago (in Scala 2). You can still use Scala 2 by the way :smiley: it’s not a dead abandoned language or anything. I just used their example project (with 2.12.8) yesterday and it works fine. Generally speaking, humans are extremely, extremely slow at switching to new language versions. Python 2 was given 12 years (2008-2020) for people to transition to Python 3, and it’s still around and many people still insist on using it :smiley: So, switching all the Scala 2 resources to Scala 3 would naturally take some time. 1 years 4 months is nothing in my opinion.

Even though I’m not trying to defend Scala here (not really my favorite language), I’d have to say that Scala has probably some of the best, highest quality, free online learning sources that are created directly by the language creators: Learn Scala with Online Courses | The Scala Programming Language I agree it’s unfortunate that they are not aimed at pure beginners, but I think that slowly in a few years the Scala Center will probably close that gap. Scala is an open source community effort, so naturally things take time.

Even if all that was just me making up excuses, who cares? What the authors think or don’t think has no bearing on your own personal journey. Ignore what you can’t control, and just focus on what you want to do.

1 Like

Thanks for your feedback and reassurance. I’ll just give it a try and see if I can use and properly follow the resources already mentioned.
So what is your favorite language?

Thank you @Jasper-M. Sorry I’m coming to this late. I’m about 100-pages into converting the CS1 textbook to Scala 3 and I haven’t started with the CS2 textbook. I have to admit that most of the time I spend on teaching materials is driven by teaching and I’m in the second year of academic leave, so I haven’t been doing any teaching. I am hoping to move things over to Scala 3, but time is always a limiting factor and revising 1500 pages or material (which the publisher wants cut down to 800) is time consuming.

2 Likes

Hi!
I agree that it would be nice to see more movement in the Scala-as-a-first-language space. Still, as others have pointed out, there is something already. I can add one more item to the list.

We’ve been teaching introductory programming in Scala for a decade, with an intake of more than a thousand students per year now. We use an extensive ebook (in the form of a web site) that’s been written for the course; it’s very popular among our students and usable for free by anyone. The main author has described that in some more detail in another thread: Collaborating on scala for newbies guide? - #8 by juha

For 2022, we’ve updated everything to use Scala 3. The new course, which is running right now, is here: Course materials | O1 | A+

Our impressions of Scala 3 as an introductory language are very positive so far.

6 Likes

I don’t like python. can I run scala as a script language? I am from golang ecosystem. thanks.

2 Likes

You might want to start a separate question for that @frakass .

Scala isn’t very good for scripting out-of-the-box. There is Ammonite scripting, it works with Scala 2.

Yes, you can run Scala as a scripting language.

Scala CLI: https://scala-cli.virtuslab.org
Ammonite: https://ammonite.io

Each has its own flavor of scripting.

2 Likes

To be honest scala 3 is quite good: with toplevel definitions you can write a single-file Scala program, and invoke it easily with the scala command or the excellent Scala-CLI (or just use a shebang at the beginning of your file and make it executable, like a bash script).

3 Likes