Connecting...

Image 2021 03 18 T09 11 28

OOP versus Type Classes in Scala by Alex Nedelcu at Scala Love in the City

Image 2021 03 18 T09 11 28

​We are still reeling from the amazing buzz and talks at Scala Love in the City Conference 2021.

...if you missed it then do not worry! We will be releasing various talks over the coming weeks.

Scala is a hybrid OOP+FP language.

If you love OOP, Scala is one of the best static OOP languages. But Scala also exposes parametric polymorphism and can encode type classes. Thus, developers can also choose to use parametric polymorphism restricted by type classes (aka ad hoc polymorphism). As if choosing when to use immutability versus object identity wasn't bad enough, developers are also faced with a difficult choice when expressing abstractions. Such choices create tension in teams, with the code style depending on the team leader or whoever does the code reviews.

Let's go through what is OOP, what is ad hoc polymorphism via type classes, how to design type classes, go through the pros and cons, and establish guidelines for what to pick, depending on the use case.

​​

Stay posted - lots more to come!!