A Scala implementation of Circuit Breaker

In this post I’ll describe how to use sse-breaker, a small library that implements the Circuit Breaker stability design pattern in Scala. Before mentioning any sse-breaker specifics lets quickly define what is a Circuit Breaker. A Circuit Breaker is a software component that keeps track of the error rate of various operations and when the […]

Catching Throwable in Scala

Because of Scala‘s pattern matching syntax it is really convenient to catch Throwable instead of Exception or any other exception type. Instead of writing: try { iMayHaveIllegalState.doSomething() } catch { case e: IllegalStateException => e.printStackTrace() } we can simply write: try { iMayHaveIllegalState.doSomething() } catch { case e => e.printStackTrace() } You might be tempted […]

Don’t use vars inside singleton objects

Scala enables immutability and functional programming but it does not dictate it. As easy it is to create immutable state via a val it is equally easy to create mutable state via a var. IMHO this is a good thing since the programmer is free to choose the programming style to use according to the […]