Crime scene. Programs are being blown up.

Location. In traits.

Pattern. Abstract values are always around.

Hmmm. Suspicious.

Things are not always what they seem to be.

There appears to be some controversy around the inclusion of abstract values in traits, since they are often seen together with NullPointerException ...

more ...

Here is the Warmer example (which was introduced here) using value injection on traits):

  // =======================
  // service interfaces
  trait OnOffDevice {
    def on: Unit
    def off: Unit
  trait SensorDevice {
    def isCoffeePresent: Boolean

  // =======================
  // service implementations
  class Heater extends OnOffDevice {
    def on = println("heater.on")
    def off = println("heater.off")
  class PotSensor extends SensorDevice {
    def ...
more ...


This text presents the concept and characteristics of value injection on traits which is a Dependency Injection (DI) variant in Scala which I have been using lately instead of the cake pattern and the DI variants that Martin Fowler introduced.

I hope to clarify the elegance of this pattern ...

more ...

This is the place of my new blog, moving away from Wordpress, and moving to Pelican. Pelican is a static site generator written in Python which enables serving a site directly from Github.

Pelican makes writing a post as easy as pushing a file to Github. So writing has become ...

more ...