Scala, Design Patterns, Programming, Factory Pattern.
its subtypes were implemented the following way. abstract class Reader { var path: String def open(): Unit } private case class csvReader(var path: String) extends Reader { override def open(): Unit = System.out.println(s"csvReader opened csv on path ${path}") } private case class jsonReader(var