Skip to content
This repository was archived by the owner on Mar 27, 2025. It is now read-only.

Commit 73a3ab9

Browse files
authored
Add slide deck reveal.js (#112)
1 parent 94b49bc commit 73a3ab9

File tree

24,547 files changed

+2681300
-2
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

24,547 files changed

+2681300
-2
lines changed

slides/.npmignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
/test
2+
/examples
3+
.github
4+
.gulpfile
5+
.sass-cache
6+
gulpfile.js
7+
CONTRIBUTING.md

slides/00-title-page.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<!-- .slide: data-background-color="#781010" data-background-image="images/bg-reveal.ps.png" -->
2+
3+
[//]: # (The following is a hack to move the slide H2 section down)
4+
## &#173;
5+
## &#173;
6+
## &#173;
7+
## Present day Java versus Scala
8+
#### &#173;
9+
#### *Modern Java's features from a Scala developer's point of view*
10+

slides/01-introduction.md

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
<!-- .slide: data-background-color="#781010" data-background-image="images/bg-reveal.ps.png" -->
2+
3+
[//]: # (The following is a hack to move the slide H2 section down)
4+
## &#173;
5+
## &#173;
6+
## &#173;
7+
## Introduction
8+
9+
---
10+
11+
## Course overview
12+
## &#173;
13+
14+
* In this course we will:
15+
* Start from an existing Scala (2.13)/[Akka Typed](https://doc.akka.io/docs/akka/current/typed/actors.html#module-info) (2.6) based application
16+
* Apply features introduced in the Scala language as part of the Scala 3 project
17+
### &#173;
18+
* The objective is to illustrate how these new features:
19+
* Bring added value and can simplify Scala code
20+
* Remove some of the inconsistencies or warts from the Scala 2 language
21+
22+
---
23+
24+
## Course prerequisites
25+
## &#173;
26+
27+
* The participants should have practical experience with the Scala 2 language
28+
* The course has a number of exercises and each student should have a computer with the following installed:
29+
* JDK 11 (e.g. [AdoptOpenJDK 11](adoptopenjdk.net))
30+
* [sbt](https://www.scala-sbt.org/1.x/docs/Setup.html)
31+
* An editor or IDE of your choice configured to work with Scala 3 code
32+
* Possible options are:
33+
* [Metals](scalameta.org) with your client of choice ([Visual Code Studio](https://scalameta.org/metals/docs/editors/vscode.html), [Vim](https://scalameta.org/metals/docs/editors/vim.html), etc…)
34+
* [IntelliJ IDE](https://www.jetbrains.com/idea/) with the Scala plugin installed and [configured to use the nightly build](https://blog.jetbrains.com/scala/2020/03/17/scala-3-support-in-intellij-scala-plugin/)
35+
* Optionally install the Scala 3 compiler and Scala 3 REPL
36+
* This can be done using Coursier:
37+
* *`cs install scalac:3.3.0`*
38+
* *`cs install scala:3.3.0`*
39+
40+
---
41+
42+
## Preparing for the exercises
43+
## &#173;
44+
45+
* Download the student-ready version of the exercises [here](https://github.com/lunatech-labs/lunatech-scala-2-to-scala3-course/releases)
46+
* Unzip the downloaded artefact and *`cd`* into the *`lunatech-scala-2-to-scala3-course`* folder
47+
* This folder contains an *`sbt`* project that contains all the exercises
48+
* Start an *`sbt`* session in the root folder
49+
* Load the project into your favourite development environment (IDE)
50+
51+
---
52+
53+
## Student exercise repository functionality
54+
## &#173;
55+
56+
- We use the *`cmtc`* command from the command line to navigate the course.
57+
58+
![CMT commands](images/cmtc-commands.png "CMT-commands")
59+
60+
---
61+
62+
## Agenda - I
63+
## &#173;
64+
65+
* Course Overview
66+
* A recap on:
67+
* Scala 2
68+
* The Scala 3 project
69+
* The Akka Toolkit
70+
* A detailed look at the Scala 2/Akka Typed based Sudoku Solver
71+
72+
---
73+
74+
## Agenda - II
75+
## &#173;
76+
77+
* Scala 3 features & exercises:
78+
* **scala3-compiler** code rewrite capabilities
79+
* [Top Level Definitions](https://dotty.epfl.ch/docs/reference/dropped-features/package-objects.html)
80+
* [Parameter Untupling](https://dotty.epfl.ch/docs/reference/other-new-features/parameter-untupling.html)
81+
* [Extension methods](https://dotty.epfl.ch/docs/reference/contextual/extension-methods.html)
82+
* [Contextual Abstractions](https://dotty.epfl.ch/docs/reference/contextual/index.html) ([given instances](https://dotty.epfl.ch/docs/reference/contextual/givens.html), [using clauses](https://dotty.epfl.ch/docs/reference/contextual/using-clauses.html), [summoning instances](https://dotty.epfl.ch/docs/reference/contextual/using-clauses.html))
83+
* [Enumerations](https://dotty.epfl.ch/docs/reference/enums/enums.html) and [export clauses](https://dotty.epfl.ch/docs/reference/other-new-features/export.html)
84+
* [Intersection Types](https://dotty.epfl.ch/docs/reference/new-types/intersection-types.html) and [Union Types](https://dotty.epfl.ch/docs/reference/new-types/union-types.html)
85+
* [Opaque Type Aliases](https://dotty.epfl.ch/docs/reference/other-new-features/opaques.html)
86+
* [Multiversal Equality](https://dotty.epfl.ch/docs/reference/contextual/multiversal-equality.html)
87+
* Wrap-up & Conclusions
88+
89+
---
90+
91+
## The teachers
92+
## &#173;
93+
94+
* Eric Loots
95+
* Adrien Picquerez
96+
* Trevor Burton-McCreadie
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
<!-- .slide: data-background-color="#781010" data-background-image="images/bg-reveal.ps.png" -->
2+
3+
[//]: # (The following is a hack to move the slide H2 section down)
4+
## &#173;
5+
## &#173;
6+
## &#173;
7+
## &#173;
8+
## Recap
9+
### Scala 2, Dotty, Scala 3, and Akka Typed
10+
11+
---
12+
13+
## Scala 2 - The current state
14+
## &#173;
15+
16+
* Currently supported versions
17+
* 2.12
18+
* 2.13
19+
* Important progress on compiler performance and collections rewrite
20+
* New, binary compatible *`Vector`* implementation
21+
* Most recent release 2.13.10
22+
* Allow, under some restrictions to use Scala 3 libraries in Scala 2 code (using Tasty) and vice-versa. See the [Compatibility Reference pages](https://docs.scala-lang.org/scala3/guides/migration/compatibility-intro.html) in the Scala 3 Migration Guide
23+
24+
---
25+
26+
## Dotty/Scala 3
27+
## &#173;
28+
29+
* Dotty 0.21.0-RC1: feature complete for Scala 3 (December 2019)
30+
* 3.0.0 released on May 13, 2021
31+
* Current release 3.2.2 released on February 1st, 2023
32+
* Tooling - Status
33+
* Metals:
34+
* integrated support in Metals including Scala Worksheet support!
35+
* IntelliJ
36+
* Scala 3 support in Scala Plugin
37+
* There's the [Scala 3 Migration Guide](https://docs.scala-lang.org/scala3/guides/migration/compatibility-intro.html)!
38+
39+
---
40+
41+
## The Actor Model and Akka
42+
## &#173;
43+
44+
* As mentioned before, the Scala 2 application we'll be working with, uses the Akka toolkit and is composed of a number of so-called Actors
45+
* Akka Actors are based on the [Actor Model](https://en.wikipedia.org/wiki/Actor_model) invented by [Carl Hewitt ](https://en.wikipedia.org/wiki/Actor_model)in 1973
46+
* The Actor Model provides:
47+
* A higher level of abstraction for writing *concurrent and distributed* applications
48+
* Alleviates the developer from having to deal with explicit locking and thread management
49+
* An Actor is the base unit of computing in the Actor Model
50+
* An Actor
51+
* Has an address (of type ***ActorRef***)
52+
* Can send messages to other Actors
53+
* Can create other Actors
54+
* Has a behaviour that can potentially change after processing a message
55+
56+
---
57+
58+
## Akka Actors - Protocol Definition
59+
## &#173;
60+
61+
* An Actor has a Protocol that defines
62+
* The message [types] it can process: so-called ***Commands***
63+
* The messages it can send in response: so-called ***Responses***
64+
65+
![Actor protocol](images/Actor-protocol.png "Actor-protocol")
66+

slides/03-the-scala2-application.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<!-- .slide: data-background-color="#781010" data-background-image="images/bg-reveal.ps.png" -->
2+
3+
[//]: # (The following is a hack to move the slide H2 section down)
4+
## &#173;
5+
## &#173;
6+
## &#173;
7+
## &#173;
8+
## THE SCALA 2/AKKA TYPED BASED SUDOKU SOLVER
9+
10+
---
11+
12+
## The Reference Scala 2 Application
13+
## &#173;
14+
15+
- A Scala 2/Akka Typed based Sudoku Solver
16+
- Actor based - mimics how one manually solves a Sudoku
17+
18+
![Sudoku problem decomposition](images/sudoku-decomposition.png "sudoku-decomposition")
19+
20+
---
21+
22+
## The Reference Scala 2 Application
23+
### The Cast (composed of 30 actors)
24+
25+
![Sudoku solver implementation](images/sudoku-solver-implementation.png "sudoku-solver-implementation")
26+
27+
---
28+
29+
## The Reference Scala 2 Application
30+
## &#173;
31+
32+
- Let's have a look at the code!
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
<!-- .slide: data-background-color="#781010" data-background-image="images/bg-reveal.ps.png" -->
2+
3+
[//]: # (The following is a hack to move the slide H2 section down)
4+
## &#173;
5+
## &#173;
6+
## &#173;
7+
## &#173;
8+
## THE SCALA 3 COMPILER CODE REWRITE CAPABILITIES
9+
10+
---
11+
12+
## Content
13+
## &#173;
14+
15+
* The Scala3 compiler's rewrite capabilities fall into three categories:
16+
* Rewrite some deprecated language syntax
17+
* Rewriting to alternative syntax using significant indentation
18+
* Rewriting to alternative control structures syntax
19+
* For the last two, rewriting can also be in the opposite direction
20+
#### &#173;
21+
* Let's have a detailed look at each of them
22+
23+
---
24+
25+
## Rewriting of deprecated syntax - I
26+
* Deprecations are tightly coupled to a version of the language
27+
* In general, a language feature will be marked deprecated in some version of the language.
28+
* A Scala release is versioned with a *MAJOR.MINOR.PATCH* version scheme
29+
* Source compatibility versus Binary compatibility
30+
* Source incompatibility may manifest itself at the *MAJOR* and *MINOR* version level
31+
* For *MINOR* versions, a particular feature may be removed or changed by passing through a deprecation stage
32+
33+
---
34+
35+
## Rewriting of deprecated syntax - I
36+
* The Scala 3 compiler has a number of options that can automatically rewrite some deprecated language features
37+
* There's a strategy defining how language features will be phased in and out after the Scala 3.0 release
38+
* Scala 3.0
39+
* Support of Scala 2.13 syntax which had some deprecations
40+
* Rewrite of these via the ***-rewrite -source:3.0-migration*** compile options
41+
* Scala 3.x (x >= 1)
42+
* Support of Scala 3.0 syntax which introduced new deprecations
43+
* Rewrite of these via the ***-rewrite -source:future-migration*** compile options
44+
45+
---
46+
<!-- .slide: data-background-color="#94aabb" data-background-image="images/bg-reveal.ps.png" -->
47+
48+
## Rewriting of deprecated code
49+
## &#173;
50+
* In this exercise, we will use Scala 3's code rewriting capabilities to automatically rewrite some deprecated code
51+
* Make sure you're positioned at exercise *"dotty deprecated syntax rewriting"*
52+
* Follow the exercise instructions provided in the README.md file in the code folder
53+
54+
---
55+
56+
## New syntax in Scala 3
57+
## &#173;
58+
59+
* Scala 3 introduces a number of syntax changes for Scala 2 language constructs such as
60+
* Contextual Abstractions (implicits)
61+
* Extension methods
62+
* ...
63+
* Two other notable syntax changes
64+
* New Control Syntax (opt-in)
65+
* "Fewer Braces" syntax: indentation is significant
66+
67+
---
68+
69+
## New Control Structure syntax in Scala 3
70+
## &#173;
71+
72+
![New control structure syntax](images/new-control-structure-syntax.png)
73+
74+
---
75+
76+
## Curly braces versus Significant Indentation
77+
## &#173;
78+
- Curly braces versus Significant Indentation
79+
80+
![New control structure syntax](images/curly-braces-versus-significant-indentation.png)
81+
82+
---
83+
84+
## New syntax in Scala 3
85+
## &#173;
86+
87+
* ***scalac*** can rewrite code (both ways) to New Control Syntax and Optional Braces syntax
88+
* Move one step at a time by using the following compiler options:
89+
* ***-rewrite -new-syntax***
90+
* ***-rewrite -old-syntax***
91+
* ***-rewrite -indent***
92+
* ***-rewrite -noindent***
93+
## &#173;
94+
* Let's give this a spin!
95+
96+
---
97+
<!-- .slide: data-background-color="#94aabb" data-background-image="images/bg-reveal.ps.png" -->
98+
99+
## New Control Syntax and Optional Braces Syntax
100+
## &#173;
101+
102+
* In this exercise, we will use Scala 3's code rewriting capabilities to automatically rewrite between different syntax options
103+
* Make sure you're positioned at exercise *"dotty new syntax and indentation based syntax"*
104+
* Follow the exercise instructions provided in the README.md file in the code folder
105+

0 commit comments

Comments
 (0)