Scala, Design Patterns, Programming, Factory Pattern.
following. object Test extends App { val csvReader = ReaderFactory("file.csv") csvReader.open() val jsonReader = ReaderFactory("file.json") jsonReader.open() val parquetReader = ReaderFactory("file.parquet") parquetReader.open() } Using this approach it’s optional and it is thought to be dangerous.