Specifying behavior with Protocols, Typeclasses or Traits. Who wears it better (Python, Scala 3, Rust)?
04-17, 16:20–16:50 (Europe/Berlin), A1

In this talk, we will explore the use of Python's typing.Protocol, Scala's Typeclasses, and Rust's Traits.
They all offer a very powerful & elegant mechanism for abstracting over various concepts (such as Serialization) in a modular manner.
We will compare and contrast the syntax and implementation of these constructs in each language and discuss their strengths and weaknesses. We will also look at real-world examples of how these features are used in each language to specify behavior, and consider differences in terms of type system expressiveness and effectiveness. By the end of the talk, attendees will have a better understanding of the differences and similarities between these three language features, and will be able to make informed decisions about which one is best suited for their needs.


Within simple applications abstractions are only needed to a certain degree.
E.g., why would someone need a complex class hierarchy, if the task at hand could be solved more pragmatically?
However, as applications and the business get more complex, abstractions can become crucial for improving the quality and maintainability of your code.
With typing.Protocol a great Python language feature was introduced, which allows abstraction and modularization while also having static typing. This allows for very robust software development.
How do other languages solve that problem?
Besides typing.Protocol we’ll also dive into the world of Scala Typeclasses, and Rust Traits, and explore how these features are used in each language to ensure the correctness and safety of code.
All these mechanisms have in common that they specify behavior for types in a very flexible and safe manner.


Expected audience expertise: Domain

Intermediate

Expected audience expertise: Python

Intermediate

Abstract as a tweet

Did you ever wonder how to elegantly & safely abstract over concepts in your code? Check out Python's typing.Protocol, Scala's Typeclasses, and Rust's Traits!

Public link to supporting material

https://github.com/koljamaier/specifying-behaviour

I love architecting & building data products that have business impact. Drilling into business domains and leveraging data to thrive the business excites me. Passionate about shaping company culture around and towards data.