2

I am a order management system that has models that have many fields that are common amongst the classes.

ProductType1(p1: String, p2: String, p3: String, ....)
ProductType2(p1: String, p2: String, p3: String, ....)
ProductType3(p1: String, p2: String, p3: String, ....)

where p1, p2, p3 are common and then there are properties that are unique to each case class.

Is the best practise to use inheritance or just duplicate the properties?

Gaël J
  • 11,274
  • 4
  • 17
  • 32
Blankman
  • 259,732
  • 324
  • 769
  • 1,199
  • The flag "opinion-based" seems excessive. You might want to have a look to https://stackoverflow.com/questions/12705309/scala-case-class-inheritance anyway in Scala case class inheritance is not possible, thus you don't really have the choice. – Gaël J May 15 '21 at 11:50

0 Answers0