Please log in to watch this conference skillscast.
You've used standard type-safe practices and immutable structures to build applications that are quite reliable. You still deal with failure modes that are not caught by the compiler. Could you reasonably go further and gain extra safety? We'll look at a key invariant that goes unchecked in most applications and then show how approachable it can be in Scala with support from a small library named total-map (github.com/boldradius/total-map).
Map data structures are often used quite liberally to associate data to entities, such as users, sessions or transactions. Those are typically identified by a numeric key. This works well for optional data, but often we'd like to guarantee that data is present for every entity.
We show how identifier types can evolve to track dynamic sets of entities. We use these types as keys to build total maps. Since lookups in total maps are always successful, we can eliminate important error-handling code paths and increase application reliability. We walk through the conversion of an application from maps to total maps and discuss benefits, challenges and alternatives.
YOU MAY ALSO LIKE:
- Lightbend Scala Language - Professional (in London on 17th - 18th September 2018)
- Lightbend Scala Language - Expert (in London on 19th - 21st September 2018)
- Lightbend Akka for Scala - Professional (in London on 25th - 26th October 2018)
- ScalaX2gether Community Day 2018 (in London on 15th December 2018)