actors

In Erlang, processes share no memory and interact only by sending messages alvin June 18, 2017 - 11:28am

“In Erlang, processes share no memory and can interact with each other only by sending messages. This is exactly how objects in the real world behave.”

Erlang: Processes interact by one method: exchanging messages alvin June 18, 2017 - 11:25am

“Processes interact by one method, and one method only, by exchanging messages. Processes share no data with other processes. This is the reason why we can easily distribute Erlang programs over multicores or networks.”

Joe Armstrong, in his book,
Programming Erlang: Software for a Concurrent World

An Akka actors ‘remote’ example alvin February 28, 2017 - 8:55pm

While doing some crazy things with SARAH, I realized that the best way to solve a particular problem was to use remote Akka actors. I haven’t had the opportunity to work with Akka much since finishing the Scala Cookbook, so I dug around trying to find a simple Akka remote “Hello, world” example. Unable to find a good one, I read some stuff, and created it myself.

A second Akka remote example: Sending objects as messages

A few days ago I shared the source code for a simple Akka remote actor example. In that example I showed how to communicate between actors in two different JVMs using Scala and Akka. In that example I showed how to communicate between the two JVMs using String messages because I didn’t want to make the example any harder than necessary.

Today, I’m taking that example just one step further to show how to communicate between actors on different JVMs by using custom objects for your messages.

How to write Akka Actors: An example video game

With just a little bit of free time left before I have to go “back to work,” I decided to try to write another visual demo of Akka Actors. I gave myself 10 hours to write something, and at first I decided to just create some bubbles that would move about randomly on screen. But I got that working so fast that I decided to do something else.

Eventually I came up with the idea of a little “kill the bubbles” game, which turned into a “kill the characters” game. This video shows how it works:

An Akka Actors Ping-Pong example

Here’s a 30-second “ping-pong” demo using Akka Actors:

The source code

If you want the source code, you can get it from the GitHub link shown at the end of this post. First, here’s a quick description of it.

The code is in two files, PingPong.scala and PingPongPanel.scala.

PingPong.scala contains three actors:

Wanted: Scala Cookbook reviewers

UPDATE: I originally posted this article in January, 2013, and it's now mid-February, 2013, and we're no longer looking for reviewers. I've only kept this page here so people won't get 404 errors.

OLD CONTENT:

Interested in being a reviewer for the Scala Cookbook?

What's new in Scala 2.10

Just a quick note that Scala 2.10.0 was released recently, and the following page, Scala 2.10.0 now available, contains a nice summary of what's new in the official Scala 2.10 release. The short list of new features includes: