At Scaladays this year I presented a talk called Unsung Heroes, with some of my favorite Scala patterns and practices summarized in it. The talk can be found on Parleys. I felt that several of the patterns presented deserved a little more detail, and nothing adds detail like running code.

With that in mind, I am starting to put the patterns into a series of Activator templates and the first of these is now available. This template is called typeclass-tips and covers some of the ideas that are useful like:

  • Using type classes to provide serialization for domain objects
  • Boilerplate busting with companion objects
  • Making a companion object into its own type class
  • Taking advantage of the nature of case classes for easier serialization
  • Swapping serialization implementations in a few lines by swapping implicits

and more...


The template is available on github and is described on the Typesafe Activator templates site. You can most easily get it by downloading Activator (if you don’t have it already) and then searching for typeclass in the templates (the full description is Tricks and Tips with Type Classes in Scala). If you haven’t tried Activator before, this is a great opportunity to give it a whirl - it’s an excellent tool for learning.

Share


Discuss


View All Posts or Filter By Tag


×

Welcome to the Lightbend Enterprise Suite


You are excited about Reactive applications. And you want to build, manage and monitor them easily and reliably in your environment.
We get it. So we built Lightbend Enterprise Suite to help you do that, and more, with a range of powerful Application Management, Intelligent Monitoring, Enterprise Integration and Advanced Tooling features.

×

Welcome to the Lightbend Enterprise Suite


You are excited about Reactive applications. And you want to build, manage and monitor them easily and reliably in your environment.
We get it. So we built Lightbend Enterprise Suite to help you do that, and more, with a range of powerful Application Management, Intelligent Monitoring, Enterprise Integration and Advanced Tooling features.