Blog

September 6, 2012

An Akka kata with the Scala Meetup group in Stockholm/Gothenburg

September 6, 2012

Björn Antonsson and myself, Henrik Engström, from the Akka team met up with the Scala Meetup group in Stockholm to do an Akka coding kata. The Gothenburg group joined in via Skype. This post will describe the kata and the overall experience.

What’s a kata?

From Wikipedia: “Kata is a Japanese word describing detailed choreographed patterns of movements practised either solo or in pairs. … More recently, kata has come to be used in English in a more general or figurative sense, referring to any basic form, routine, or pattern of behavior that is practiced to various levels of mastery.”

Katas have been used to master everything from the traditional tea ceremony, karate and, for the first time afaik, for mastering Akka.

The Akka kata

We, in the Akka team, sat down one lunch and discussed what “movements” we wanted the kata to cover and a good domain to which we could apply those “movements.” The result was a betting domain in which you should be able to recover everything from small hick-ups to JVM crashes. This would cover some of the essential bits of Akka like:

  • Creating actor systems and actors
  • Sending and receiving messages
  • Scheduling tasks
  • Supervising actors and taking appropriate action

Design Overview - Scaffolding

The aim of this kata was to point the student in the right direction. To enable this we created some scaffolding code together with a brief introduction of the Akka concepts that they would need to solve the task ahead. You can find the project here:

https://github.com/henrikengstrom/akka-meetup-sthlm

We also did a very simplified overview of what parts the application consisted of and also what communication between these parts that was needed. You can find the overview here below.

Akka_kata

The Meeting

We started off the meeting with a very brief introduction of what Akka is and some of the concepts and features that you use when you build systems with Akka. After that there was a more hands on walk through of the parts of Akka that were relevant to this kata - we call this the Akka green belt examination.

Every meeting participant had a computer and everyone had also installed the scaffolding code beforehand so we asked them to pair up two and two and then get started. Björn and I circled the room, like hawks, answering questions, giving advice while also having a lot of fun. We estimated that they would be able to solve the kata in about two hours time and this seemed like a good estimation. Not everyone was 100% done when we presented the solution proposal, but not far away from a complete solution.

The Solution Proposal

There is no correct way of implementing a system - there are many ways! Therefore you should view the proposal we have made as one solution not the solution.

The above also became apparent when we presented the solution to the group. Many had solved the task a little bit different than the way we had. We discussed pros and cons with the alternatives and also got into the differences between designing a standard n-layered system and an actor based system. Overall a very interesting and productive experience - for both us from the Akka team and the participants in the meeting. We, in the team, feel it is extremely valuable to see how users of Akka apply it to their domains. It is only with this feedback loop we can continue to improve and evolve Akka to become even greater than it already is.

When you are done with your kata you can compare your solution to the proposal we have created: https://github.com/henrikengstrom/akka-meetup-sthlm/tree/solution

About the Senseis

Henrik Engström - @h3nk3

After graduating with a M.Sc. degree in Computer Science in 1998 at the Royal Institute of Technology in Stockholm Henrik has been working as a consultant up until his Typesafe employment in 2011. Henrik has not only vast experience from programming languages but also a great domain knowledge within the financial, retail and e-gambling industries. Apart from his major interest, programming, he is also an avid Arsenal supporter, black belt in Shotokan Karate and a hobby wine connoisseur.

Björn Antonsson - @bantonsson

Björn is a passionate software engineer with a M.Sc. in Computer Science from the Royal Institute of Technology in Stockholm, whose experience ranges from the lowest levels of hardware memory models right through the operating system and the JVM as a founder and longtime developer of JRockit, and straight up into high volume financial data systems and large traffic website.

comments powered by Disqus
Browse Recent Blog Posts