Models

Learn how to implement data models for the impure service.

We'll cover the following...

Initial implementation

First, we’ll implement our models, which are simple and straightforward. Let’s create a class to store a single translation.

Press + to interact
final case class Translation(lang: String, name: String)

This method works, but we can definitely do better.

Using Option[String] is of no use because both fields have to be set. But a String can always be null and contain a lot of unexpected things (literally ...

Access this course and 1400+ top-rated courses and projects.