Introducing Message Relay

After a long, quiet pause, we want to start off again by sharing our most reused piece of code with you: the Message Relay. he first version was created in 2007 and we have used it ever since in all of our projects.

But why?

You know those projects where your code slowly becomes a mess of direct references, while changing and even maintaining the code starts to feel more and more painful at every moment? That project where your MagicButton instance is listened to by ten other objects, and it gets moved into a new Sprite on a totally different corner of the user interface, and it’s Friday afternoon and you’d like to head to the park with beverages, but you need to start hunting down and rewriting all the listener references instead?

You might solve the problem with your Find & Replace wizardry, or you might even go as far as delve into the hazardous world of patterns, start creating your own singleton ReferenceManager class, or something silly like that, which you will regret on Monday morning.

But fear not. Message Relay is there to help you keep your code clean, while providing an understandable method of communication between objects. Enough advertising? Go and look at the examples.

Post a Comment

Your email is never shared. Required fields are marked *

*
*