ADTs in Scala (Part 2: ADTs vs OO-Classes)

post-thumb

In my latest post I presented ADTs in Scala 3. I also created a Youtube video about it (check it out here). Since the content was longer, I split it in three parts. This is the second part.

We look at the differences between classes and ADTs. We discuss:

  • Immutability
  • Inheritance
  • Public and private fields
  • Methods
  • Pattern matching

This video is an introduction to ADTs in Scala for object-oriented developers. We look at the differences and show examples of how to change values in ADTs, how methods work and pattern matching.

To run the code yourself in Scastie go to https://scastie.scala-lang.org.

comments powered by Disqus