Code, exercises, and answers for the book Get Programming with Scala.
Lessons are grouped per unit. Each lesson is a standalone SBT project and
it has the following three packages: listings, quickchecks, trythis.
Have a look at the Table of Contents for links to all the available lessons.
Make sure the following tools are installed:
- JDK 8+
- SBT
Some lessons are simple snippets (files with extension *.sc) also called Scala Worksheets. They can be interpreted interactively from the REPL by IDEs with dedicated Scala support, such as IntelliJ IDEA and ScalaIDE.
If you a using a text editor or your IDE doesn't support Scala Worksheets, start the REPL from SBT:
sbt console
and evaluate the file as follows:
> :load /path/to/file.sc
Some lessons are fully fleshed-out programs (files with extension *.scala): in order to run them, they need to be compiled. First, navigate to the folder of the lesson you are interested in.
Suppose you want to review the code for lesson 8:
cd unit1/lesson8
Start SBT:
sbt
Compile and run the code:
> run
If a lecture isn't an executable program, please see section on running Scala Worksheets.
-
UNIT 0: HELLO SCALA!
-
UNIT 1: THE BASICS
-
UNIT 2: OBJECT-ORIENTED FUNDAMENTALS
-
UNIT 3: HTTP SERVICE
-
UNIT 4: IMMUTABLE DATA AND STRUCTURES
-
UNIT 5: LIST
-
UNIT 6: ERROR HANDLING AND DATA STORAGE
- LESSON 34: Set
- LESSON 35: Map
- LESSON 36: Either
- LESSON 37: Try: an operation that can fail
- LESSON 38: Working with Try
- LESSON 39: Database queries with quill
- LESSON 40: CAPSTONE 6
-
UNIT 7: CONCURRENCY
- LESSON 41: Future
- LESSON 42: Working with Future: map and flatMap
- LESSON 43: Working with Future: for-comprehension
- LESSON 44: Future and Promise
- LESSON 45: CAPSTONE 7
-
UNIT 8: JSON (DE)SERIALIZATION
- LESSON 46: Traits as composable block of codes
- LESSON 47: Lazy values
- LESSON 48: By Name Parameters
- LESSON 49: Implicit functions and values
- LESSON 50: The IO type
- LESSON 51: JSON (De)serialization with circe
- LESSON 52: CAPSTONE 8