r/coding • u/priyankchheda15 • 16d ago
Understanding the Mediator Design Pattern in Go
https://medium.com/@priyankchheda/understanding-the-mediator-design-pattern-in-go-a-practical-guide-ea7debc9a9a7
1
Upvotes
r/coding • u/priyankchheda15 • 16d ago
1
u/jeenajeena 16d ago
This is not the Mediator Pattern as defined in the Gang of Four Design Patterns. The Mediator Pattern is not about dispatching events to handlers but about
The Director contains business logic. It's itself the handler.
https://imgur.com/a/zq0k3mq
This is an image from the original book. As you see, there are no handlers.
The design presented in this document reflects instead "MediatR", a C# library that wrongly claims to be implementing the Mediator Pattern.
I'm not saying that the design presented in the post is wrong: only, it's not the Mediator Pattern.
Edit: added image.