Everyday a numerous number of applications are deployed, servers changed, architecture changes too. In this ever-evolving landscape of software dev...
For further actions, you may consider blocking this person and/or reporting abuse
Most readers will not be in the situation to implement Amazon for new, so we should ask: does this serve for everyday tasks.
If you use any UI-library like React, you have no choice. React uses a state based reactivity. This reduces the intellectual burden on the developer, as it manages state transitions automatically. But this comes at a price: You just recognize that a state has changed, but not, why. And it can be challenging to find the right timing. If you call the rendering loop on every input, the system can be overloaded. If you use some kind of throtteling, the system may feel slow.
Event based systems are much different, as they can react much more specific. They exactliy know, when and why a state has changed. So the reaction can be very specific. The downside is, that they exactly need to know the dependencies that are affected by an event. If a page is quite complex, it might be impossible to maintain all dependencies manually, so you need some automatic tools to help you.
For small systems, the easiest form of event driven architecture can be achieved using event handlers. Each DOM element can have numerous handlers like onclick(). The event fires in the moment the user clicks. This works pretty well, but the downside is, that all participants need to know each other. Larger systems may use a centralized broker or dispatcher, like described above. This allows a more organized way to handle events.
It is often not possible to mix both architectures, though this would be the ideal approach to get the optimum speed and convenience. If you know a system that manages to use that kind of "hybrid" approach, please let me know.
So it's good to keep in mind that react has an event driven approach but as for architecture is something really different.
Could you explain this a bit more? Surely reconciliation will be triggered by user actions, but in my understanding this is different from an EDA. In EDA Events trigger specific actions, while in a state based approach all events trigger the same action.
Truth!
I think the "When Not to Use Event-Driven Architecture" is wrong.
It is only right if you make the architectural assumptions of using multiple microservices.
If you use a simpler, in-memory variants none of the downsides apply.
I would add that you can use event driven architecture in a monolith.
And you are not required/forced to use a bus or message broker and especially not as a separate microservice.
In a monolith you can just call the code/event handlers directly in a giant switch/if statement/function.
You can even replace the message brocker with a database like postgres.
There is a whole article on how to use postgres as a job queue and it can be used the same to distribute messages as well
And you can simplify even further by using sqlite -> so everything is just a single service. Sqlite is even more stable/tested/used than any other database out where.
That's why its so hard to write articles about technological/architectural decisions, because every little detail is important and can completely turn around and/or negate any pro-con comparison.
Thanks for your insightful comment! You've highlighted an important aspect of Event-Driven Architecture (EDA)—its flexibility and adaptability across different architectural styles, not just in microservices. Indeed, incorporating EDA within a monolithic application can leverage in-memory or database-based event handling, sidestepping the need for a dedicated message broker. Your mention of using databases like PostgreSQL or SQLite as alternatives for message distribution illustrates the versatility of EDA in accommodating various implementation strategies. This underscores the necessity of considering specific project requirements and contexts when discussing the pros and cons of architectural choices. I appreciate the reminder that technology discussions should account for the nuances that can significantly influence decision-making.
very descriptive, piece here, thanks for sharing
You're welcome 🚀
Easiest to understand the architecture. Thanks sir!
You're welcome
Well written article and very well explained. Congrats !
Thanks 😌
Event driven has existed since the dawn of computer.
Definitely 😅
One of the best article. Thank you and keep doing it
Thanks