Tuesday, May 1, 2007

One Word for Your Career: Lemmings

To be a virtuoso code composer in Java (or any language), one needs to understand concurrency and the memory model of the platform.

Many of us, myself included, should study and learn as much as we can about these subjects: they truly separate the masters from the apprentices.

The best resource going these days for Java is the book Java Concurrency in Practice. Get it. Just get it. After all, at your next interview, some of your competitors will have read it.

Here's a blog on a study group for the book.

re: title. What's with the lemmings you ask? Many, many moons ago in grad school, I played a wonderful computer game called Lemmings. The gist was that there were many lemmings who would flow from one place to another. They weren't very bright. The game-play was for you to control gates, ramps, and other control structures to guide the little buggers to safety, and to prevent them from causing chaos.

As the levels ratcheted up, the game became frenetic, both in terms of speed and the number of lemmings. I would play with a girlfriend -- one would observe and shout out shorthand commands; the other would operate the devices.

I now realize that we were pair-programming in a multi-threaded environment. If you played the game, you know that the analogy is profound.

ps. From the "brushing teeth after posting dept": this is crazy but I wonder if something like Lemmings could be used to visualize tests against multi-theaded programs. Sort of like a generalized, 2D version of JUnit's green/red bar. As you run the program, the display shows threads (lemmings) exploring the program/data space. It wouldn't be used to prove correctness but rather to show, visually, what is going on for a given execution. It might be illuminating.

pps. An idea that is much smaller in scope. If UML is used to represent the relationships and contracts between objects graphically, is there any such representation for concurrency?

1 comment:

Matt Taylor said...

I remember playing Lemmings, too. It was great. I can see the link with concurrent programming, as well.

If you ever extend the "Thread" class, maybe you should call it "Lemming"?