Book #15 - Programming in Scala

Programming in Scala, 5th edition
by Martin Odersky, Lex Spoon, Bill Venners, and Frank Sommers (2021) - PrePrint edition

Monday evenings - 7:10 pm pacific time

Meetup: https://www.meetup.com/Los-Gatos-Rust-Reading-Group/events/281371456
Zoom: https://us02web.zoom.us/j/84281187589
Artima: https://www.artima.com/shop/programming_in_scala_5ed
Source code (zip): https://booksites.artima.com/programming_in_scala_5ed/progInScalaExamples5Ed.zip

Notes: Scala 3

Note: On October 18, we plan to discuss whether or not we need to cover Chapter 24, per Patrick’s comment. It may be too much like a reference, not allowing for any meaty discussion. Let’s discuss

October 18 - I'm officially declaring the book DONE! We all did the first 23 chapters of 25, where the real meat was. The last two are a bit thin, or at least that seems to be the consensus here. Next book - “Functional Programming in Scala” (2nd edition)

Chapter 23
Typeclasses

October 11, 2021

Presenter

Chapter 23
Typeclasses

October 11, 2021

Presenter

Why typeclasses?

Casey

Context bounds

Patrick

Main methods

Karthik

Multiversal equality

Casey

Implicit conversions

Amish

 

Typeclass case study: JSON serialization

Amish - October 18

Chapter 22
Extension Methods

September 27, 2021
October 4, 2021

Presenter

Chapter 22
Extension Methods

September 27, 2021
October 4, 2021

Presenter

The basics

Karthik

Generic extensions

Amish

Collective extensions

Amish - October 4

Using a typeclass

Casey - October 4

Extension methods for givens

Casey - October 4

Where Scala looks for extension methods

Karthik - October 4

Chapter 21
Givens

September 20, 2021

Presenter

Chapter 21
Givens

September 20, 2021

Presenter

How it works

Patrick

Parameterized given types

Patrick

Anonymous givens

Casey

Parameterized givens as typeclasses

Casey

Given imports

Karthik - September 27

Rules for context parameters

Casey - September 27

When multiple givens apply

Amish - September 27

Debugging givens

Amish - September 27

Chapter 20
Abstract Members

August 30, 2021

Presenters

Chapter 20
Abstract Members

August 30, 2021

Presenters

A quick tour of abstract members
Type members
Abstract vals
Abstract vars

Casey

Initializing abstract vals

Casey

Abstract types

Patrick - September 13

Path-dependent types
Refinement types

Casey - September 13

Case study: Currencies

Amish - September 13

Chapter 19
Enums

August 23, 2021

 

Chapter 19
Enums

August 23, 2021

 

Enumerated data types

Patrick

Algebraic data types

Amish - August 30

Generalized ADTs

Casey - August 30

What makes ADTs algebraic

Vlad - August 30

 

Chapter 18
Type Parameterization

August 16, 2021

Presenter

Chapter 18
Type Parameterization

August 16, 2021

Presenter

Functional queues

Amish

Information hiding

Amish

Variance annotations

Vlad

Checking variance annotations

Vlad

Lower bounds

Casey

Contravariance

Casey - August 30

Upper bounds

Karthik - August 23

 

Chapter 17
Scala’s Hierarchy

August 9, 2021

Presenter

Chapter 17
Scala’s Hierarchy

August 9, 2021

Presenter

Scala’s class hierarchy

Amish

How primitives are implemented

Amish

Bottom types

Vlad

Defining your own value classes

Vlad

Intersection types

Karthik

Union types

Casey

Transparent traits

Patrick

Chapter 16
Mutable Objects

August 2, 2021

Presenter

Chapter 16
Mutable Objects

August 2, 2021

Presenter

What makes an object mutable?

Karthik

Reassignable variables and properties

Amish

Case study: Discrete event simulation

Amish

A language for digital circuits

Casey

The Simulation API

Casey

Circuit Simulation

Casey

 

Chapter 15
Working with Other Collections

July 26, 2021

Presenter

Chapter 15
Working with Other Collections

July 26, 2021

Presenter

15.1 Sequences

Casey

15.2 Sets and Maps

Karthik

15.3 Selecting mutable versus immutable collections

Karthik - August 2

15.4 Initializing collections

Amish - August 2

15.5 Tuples

Amish - August 2

Chapter 14
Working with Lists

July 19, 2021

Presenter

Chapter 14
Working with Lists

July 19, 2021

Presenter

List literals

jonnie

The List type

jonnie

Constructing lists

jonnie

Basic operations on lists

Patrick

List patterns

Patrick

First-order methods on class List

Casey

Higher-order methods on class List

Casey

Methods of the List object

Amish - July 26

Processing multiple lists together

Amish - July 26

Understanding Scala’s type inference algorithm

Casey - July 26

 

Chapter 13
Pattern Matching

July 12, 2021

Presenter

Chapter 13
Pattern Matching

July 12, 2021

Presenter

A simple example

Casey

Kinds of patterns

Casey

Pattern guards

Karthik

Pattern overlaps

Karthik

Sealed classes

Vlad

Pattern matching Options

Vlad

Patterns everywhere

Amish

A larger example

Amish

Chapter 12
Packages, Imports, and Exports

June 14, 2021

Presenter

Chapter 12
Packages, Imports, and Exports

June 14, 2021

Presenter

Putting code in packages

jonnie

Concise access to related code

jonnie

Imports

Casey

Implicit imports

Casey

Access modifiers

Amish

Top-level definitions

Karthik

Exports

Karthik

Chapter 11
Traits

June 7, 2021

Presenter

Chapter 11
Traits

June 7, 2021

Presenter

How traits work

jonnie

Thin versus rich interfaces

Karthik

Traits as stackable modifications

Casey

Why not multiple inheritance?

vlad

Trait parameters

vlad

 

Chapter 10
Composition and Inheritance

May 31, 2021

Presenter

Chapter 10
Composition and Inheritance

May 31, 2021

Presenter

A two-dimensional layout library

John

Abstract classes

John

Defining parameterless methods

John

Extending classes

Casey

Overriding methods and fields

Casey

Defining parametric fields

Casey

Invoking superclass constructors

Casey

Using override modifiers

Casey

Polymorphism and dynamic binding

Karthik

Declaring final members

Karthik

Using composition and inheritance

Karthik

Implementing above, beside, and toString

Casey

Defining a factory object

Vlad

Heighten and widen

Vlad

Putting it all together

Vlad

 

Chapter 9
Control Abstraction
May 3-10, 2021

Presenter

Chapter 9
Control Abstraction
May 3-10, 2021

Presenter

Reducing code duplication

Amish

Simplifying client code

Casey

Currying

Amish

Writing new control structures

Casey

By-name parameters

Casey

 

Chapter 8
Functions and Closures

May 3, 2021

Presenter

Chapter 8
Functions and Closures

May 3, 2021

Presenter

Methods

John

Local functions

John

First-class functions

Casey

Short forms of function literals

Casey

Placeholder syntax

Casey

Partially applied functions

Amish

Closures

Amish

Special function call forms

Vlad

Tail recursion

Vlad

Chapter 7
Built-in Control Structures

April 19, 2021

Presenter

Chapter 7
Built-in Control Structures

April 19, 2021

Presenter

If expressions

John

While loops

John

For expressions

Vlad

Exception handling with try expressions

Amish

Match expressions

Vlad

Living without break and continue

Amish

Variable scope

Amish

Refactoring imperative-style code

Vlad

Chapter 6
Functional Objects

April 12, 2021

Presenter

Chapter 6
Functional Objects

April 12, 2021

Presenter

A specification for class Rational

Karthik

Constructing a Rational

Karthik

Reimplementing the toString method

Karthik

Checking preconditions

Amish

Adding fields

Amish

Self references

Amish

Auxiliary constructors

Casey

Private fields and methods

Casey

Defining operators

Casey

Identifiers in Scala

Vlad

Method overloading

Vlad

Extension methods

Vlad

A word of caution

Vlad

 

Chapter 5
Basic Types and Operations

April 5, 2021

Presenter

Chapter 5
Basic Types and Operations

April 5, 2021

Presenter

Some basic types

Amish

Literals

Amish

String interpolation

Amish

Operators are methods

Amish

Arithmetic operations

Amish

Relational and logical operations

Vlad

Bitwise operations

Vlad

Object equality

Vlad

Operator precedence and associativity

Vlad

Rich operations

Vlad

 

Chapter 4
Classes and Objects

April 5, 2021

Presenter

Chapter 4
Classes and Objects

April 5, 2021

Presenter

Classes, fields, and methods

Casey

Semicolon inference

Casey

Singleton objects

Casey

Case classes

Casey

A Scala application

Casey

 

Chapter 3

Next Steps in Scala

March 29, 2021

Presenter

Chapter 3

Next Steps in Scala

March 29, 2021

Presenter

Parameterize arrays with types

Casey

Use lists

Casey

Use tuples

Casey

Use sets and maps

Amish

Learn to recognize the functional style

Amish

Transform with map and for-yield

Amish

 

Chapter 2

First Steps in Scala

March 29, 2021

Presenter

Chapter 2

First Steps in Scala

March 29, 2021

Presenter

Learn to use the Scala REPL

Vlad

Define some variables

Vlad

Define some functions

Vlad

Write some Scala scripts

Vlad

Loop with while; decide with if

Vlad

Iterate with foreach and for-do

Vlad

Chapter 1
A Scalable Language

March 22, 2021

Presenter

Chapter 1
A Scalable Language

March 22, 2021

Presenter

1.1 A language that grows on you

Casey

1.2 What makes Scala scalable

Amish

1.3 Why Scala?

Vlad

1.4 Scala’s roots

Casey