# Scala Level 3: Classes & Traits

> Level 3: Classes & Traits of the LoWisa Scala course: Classes and Objects, Traits, Composition. 3 lessons and 9 ideas, each explained in one line.

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

## 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

- **Before:** [Level 2: Collections](/courses/scala/level-2-collections/): Immutable Collections, Transformation Operations, Lazy and Eager Processing.
- **Next:** [Level 4: Algebraic Data Types](/courses/scala/level-4-algebraic-data-types/): Enums and Case Classes, Pattern Matching, Modelling Valid States.

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](/help/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.

---

Source: https://lowisa.dev/courses/scala/level-3-classes-and-traits/ · Updated 2026-11-30
