Scala course

Scala Level 3: Classes & Traits

Classes & Traits is level 3 of 13 of the LoWisa Scala course. It has 3 lessons and 9 ideas. Below is every lesson and what it teaches, in one line each.

Updated 2026-11-30

Classes and Objects

  • Classes. A class takes constructor parameters in its header: fields, constructor and body in one place.
  • object. An object is a built-in singleton: companion objects hold factories and shared definitions.
  • apply. The apply method makes objects callable: User("Ada") is User.apply("Ada"), by convention.

Traits

  • Traits. A trait declares interface and mixable implementation: Scala’s unit of behaviour composition.
  • Mixin composition. Classes extend one class but mix many traits: behaviour stacked at declaration.
  • Linearisation. Mixin order resolves by linearisation: a defined, inspectable answer to “whose method wins”.

Composition

  • Composition first. Scala favours composition: small traits and case classes wired together over deep towers.
  • Self types. A self type declares what a trait requires of its host: dependencies stated, not smuggled.
  • Sealed boundaries. sealed closes a hierarchy to its file: the compiler then knows every subtype that exists.

Before and after this level

In the app each of these ideas is taught and then asked back, and the level ends with a checkpoint and flashcards. See Checkpoints and flashcards.

Frequently asked questions

What does Scala Level 3: Classes & Traits cover?

Classes and Objects, Traits, Composition: 3 lessons and 9 ideas.

What should I know before this level?

The level before it, Level 2: Collections, which covers Immutable Collections, Transformation Operations, Lazy and Eager Processing.

Learn Scala on your phone

The first level is free. LoWisa is on Google Play and the App Store.