Writing apply Methods to Create Constructors (Scala 3 Video)
In this free Scala training video, I show how to write apply
methods in Scala companion objects to serve as constructors for Scala classes. While you can create constructors and auxiliary constructors in Scala classes, there are benefits to creating constructors as apply methods in Scala companion objects, and I’ve come to prefer this approach because I think the code is easier to read and organize.
Update: All of my new videos are now on
LearnScala.dev