Life can be much broader, once you discover one simple fact, and that is that everything around you that you call “life” was made up by people that were no smarter than you. And you can change it, you can influence it, you can build your own things that other people can use. Once you learn that, you’ll never be the same again.
Entity-Component-System (ECS) is a distributed and compositional architectural design pattern that is mostly used in game development. It enables flexible decoupling of domain-specific behaviour, which overcomes many of the drawbacks of traditional object-oriented inheritance.
Elixir is a dynamic, functional language built on top of the Erlang VM designed for building scalable and maintainable applications.
In this article, discover how we can use both ECS and Elixir in a novel approach to structure our programs beyond the class based inheritance paradigm.
Publish-Subscribe is a messaging pattern that works as follows: a group of consumers subscribe to events of a given topic and are notified whenever an event of that topic arrives.
When an event is published into a topic channel, the channel delivers a copy of the message to each of the output channels. The advantage of this is we can decouple the consumers from the producers. Neither party need knowledge of each other to communicate.
In other words, pub-sub is a pattern used to communicate messages between different system components without the components knowing anything about each other’s identity.
Let’s look at an implementation of Publish-Subscribe in Elixir. The full source code is provided below.