Official website

Announcing the Moving from Scala 2 to Scala 3 course

08 Jun 2020

min read

Moving From Scala 2 to Scala 3

After some early peeks at the Dotty website on a few occasions in 2019, I started looking more closely at the Dotty reference documentation after reading the release notes of the 0.21.0-RC1 Dotty release. That release marked an important milestone, namely, the announcement of Dotty as feature-complete. After reading the article Scala 2 roadmap update: The Road to Scala 3, which was referenced in the release notes, I had all I needed to test some ideas with Dotty’s new Union Types. You may have read the full report on this in part I and part II of the Using Dotty Union types with Akka Typed articles. I’m pretty sure that this approach will be adopted in some form in a future version of the Akka toolkit as an alternative to the rather convoluted way of dealing with responses to messages in Akka Typed (something which is necessary because of some limitations of the Scala 2 compiler).

So, with that behind me, I was wondering about what to do next…​ Now, I’ve always been very keen on learning new stuff, but even more on sharing knowledge with others. I’ve taught many technical courses and [co-]developed different courses on Scala and Akka while at Lightbend. So, a little less than two months ago, I decided to start working on a new course that would target existing Scala 2 developers and that would help them with the move to Scala 3. The general idea I started from was to take an existing Scala 2 application, select a number of key features in Dotty, and apply these to the application in a step-by-step fashion. The end goal was to show how these features improve and reduce the complexity in the original code.

When I floated the idea about this new course at Lunatech, I got two enthusiastic colleagues, Neil Benn and Robin Raju, to join me in the effort. After about 2 months, we delivered the first edition of the two-day "Moving from Scala 2 to Scala 3" course to a group of colleagues.

Between the start of the project and the first delivery, the alpha version of the course was kindly and thoroughly reviewed by members of the Scala Center (thanks Sébastien and Julien!). We received a lot of very useful feedback which resulted in a series of corresponding updates to the course materials. Speaking of which: we have a series of 11 exercises, a course slide deck with approximately 150 slides, and a collection of code-snippets that can be used to demonstrate various features of the Dotty language covered in the course. The topics and Dotty features that we cover in the course are:

Very important to note is that all these materials are open-sourced! You can find them in this public repository on Github. This means that you can benefit from this at no extra cost but the effort you put into studying the course materials! (Of course, should you wish to have this course taught to you in-class, feel free to reach out to us and we’re happy to talk!).

What’s next…​

So, "What’s next?", you may ask. Well, in fact, quite a bit…​ Here’s list of things that are in the works:

  • We plan to keep the course current with the release candidates of Dotty. At the time of writing, Dotty is at release 0.24.0-RC1 with 0.25 around the corner.

  • We will release versions of the course on a regular basis tracking Dotty’s progress and our coverage of Dotty features. You can following along here.

  • We’re looking at covering other new features in Dotty in the course. Stay tuned for that!

In a nutshell, a "studentified" version of the course is an artifact generated from the course master repository. This artifact is a self-contained sbt project that has special functionality built-in to provide a friendly learning experience. A student can navigate between different exercises, pull in relevant test code automatically, read exercise instructions via a manual page command, save and restore the state of the code, and "pull" the solution if required.

A "linearized" version of the course is a git repository where every exercise in the course has a corresponding commit in the repo. As such, it can be used to quickly inspect the changes between subsequent exercises. This artifact also serves another purpose: it is an essential component in a workflow to evolve the code in exercises using git interactive rebasing.

The transformation to "studentified" and "linearized" artifacts is done by the Course Management Tools (CMT) that I started developing while at Lightbend.

In case you want to learn more about CMT and how it was used while building this course: Neil, Robin and myself had a tech talk with colleagues last week about this very topic. You can view a recording of this talk here.