small medium large xlarge

REST with MochiWeb and Ruby Hook Methods


This week we’ve got two new screencast episodes for you: Erlang Episode 6: Adding REST Support with MochiWeb and Ruby Episode 7: More Hook Methods. Download and watch these episodes when and where it’s convenient for you, in DRM-free formats including QuickTime, QT for iPod, and Theora Ogg.

For those of you having trouble reading this email, this newsletter is available online at:

Erlang Episode 6: Adding REST Support with MochiWeb

It’s time to scale our chat system out to the web! In this episode, we’ll use the MochiWeb toolkit to make our chat system available to HTTP clients using REST conventions. You’ll learn how to:

  • Download, build, and install Mochiweb
  • Write a basic Erlang web server using MochiWeb
  • Use Erlang’s experimental support for parameterized modules
  • Add REST-style endpoints to the chat system developed in previous episodes
  • Register, send messages, and poll for messages from HTTP clients
  • Take advantage of Erlang’s excellent concurrency support and inexpensive processes to scale for the masses

Available at

Ruby Episode 7: More Hook Methods

We’ll pick up where we left off in the last episode by looking at two more Ruby hook methods: included and method_added. But we’ll also take it a step further. We’ll use these hook methods to develop a metaprogramming library that traces the execution of a Ruby program. Along the way we’ll see all the various subtle (and important!) things you need to think about when you’re trying to write a general-purpose metaprogramming library:

  • Using included to intercept when a module is included in a class, and use it to set up another hook method in a different context
  • Using method_added to track when a new method is defined on a class, and trace the method’s execution
  • Refactoring the tracing to support blocks
  • Using method objects to bypass naming issues
  • Adding tracing to methods that have already been added
  • Suppressing tracing for certain methods
  • Using Thread.current to define thread-local variables
  • Differences between Ruby 1.8 and 1.9
  • Practical examples (and corner cases) of metaprogramming

Available at

Coming Soon:

  • iPhone SDK Development—still waiting on Apple…
  • Scripted GUI Testing with Ruby
  • Web Design Techniques for Programmers
  • Managing Websites with ExpressionEngine

Recently Released:

Thanks for your continued support,

Andy & Dave