It’s been a long time since I last played with Scala. Being a .Net Samurai, I tend to have a love/hate relationship with the JVM. As I had a couple of hours to kill today, I figured I might as well refresh my Scala knowledge by working on the Coffeeshop problem with Akka.
Akka is a concurrency/distributed applications framework based on the Actor models. It allows you to define entities as Actors that can communicate amongst each other as part of an ActorSystem that may exist across multiple machines. In the case coffeeshop problem, you would define your Customer, your Barista as Actors that need to communicate with each other. In my case, I also decided to make the Coffeeshop an Actor. Why? Just for the fun of it 😀
Here’s the code made it all happen!
Akka is pretty simple & easy. I might use it later on to try solving the Elevator problem if I get a few more hours to spare.