Showing posts with label mistakes. Show all posts
Showing posts with label mistakes. Show all posts

Wednesday, September 29, 2010

The Strategy pattern and Traits

So I promised I would talk about patterns and traits. When I wrote about the concepts of the Controller and the RuleSet, I already hinted at using the Strategy pattern. I was right, because that turned out to be exactly what I needed. And I was wrong, because the classical Strategy pattern is an ill match for Scala.

In this post I will explain how I implemented the Strategy pattern using Scala traits, and how this turned out to be an unsatisfying approach.