Message Oriented Programming

MountainWest RubyConf 2015 - Message Oriented Programming
by Brian Knapp

“I’m sorry that I long ago coined the term “objects” for this topic because
it gets many people to focus on the lesser idea. The big idea is
“messaging” - that is what the kernal of Smalltalk/Squeak is all about
(and it’s something that was never quite completed in our Xerox PARC
phase).” - Alan Kay

Object oriented programming is what gets a lot of attention, and it is
often set in opposition to functional programming. However, it seems
that OOP with its focus on classes, inheritence, and polymorphism
missed what Alan Kay was really working on - messaging systems.

In this talk we will examine the fundamental pieces to what I
am calling message oriented programming. We will look at the
request/response message pattern, we will look at the structure of
messages themselves, and we will look at how protocols can be created to
enforce a sane message passing system.

We will also look at how this fits with Ruby, OOP, FP, and modern
distributed computing patterns like REST, SOA and microservices. They
are all related an it’s clear that message oriented programming has a place
in the programmer’s toolbox. In fact, we are already using message
oriented program to power modern applications, we just don’t know it yet.

I agree with the idea behind this. We see some of this in ActiveRecord with error messages:

result =
raise if result.errors.any?

I’d be interested in getting more into MOP as a design pattern. Also I like the idea of defining a protocol. Communicating anything requires a language of some sort and any one language has its rules (aka protocol) for what means what.

What are your thoughts or insights on this? Do you have experience with this way of implementing code? Any pros or cons? Does Ruby not need this pattern as much because of DuckTyping?

1 Like