Case classes may extend other classes and traits in contrast to Tuple agglomeration of classes which extend a Product (see for instance Tuple2).

In the use case here, the case class labels each member which may lead to more readable code, in contrast to the 6-tuple reference (t._1 to t._6).


It's convenient to have such data structure for intermediate results. Create classes for results, that returns from your API (or public methods) and use tuples for intermediate results that you discard few lines la

Also, they have some good use cases in collections, for example:

Seq(2,3,4).zipWithIndex.foreach { case (element, index) => println(s"$index:$element") }


In your example, the case class is clearly a better idea/design. However, one frequent use that I make of tuples is typically when I am handling scala maps, which makes extensive use of them.

Related Query

More Query from same tag