To become or not to become ... a Sunday with Scala and Actors

2013-10-07 Software-Engineering Functional-Programming Scala

It is Sunday, the sun is shining ... in Ireland!!! What do you do? Right: You get your laptop and finally start to get your head around the actor model in Scala.

In my case I tried to come up with a simulation for the Dining Philosophers Problem (DPP). There are implementations available, but I consolidated them and renamed the states and transitions to make it more obvious what is going on and used plantUML to come up with State Transition Diagrams (STDs) that show what is going on.

The model detects potential deadlocks and asks the philosopher to put down all forks, before trying again.

The epiphany of the day was that you need to use become() to model the states :).