Ask HN: Has anyone fully embraced an event-driven architecture?
Here is an alternate point of view: Everything is event-based. Fundamentally, our universe is event based; things interact via events mediated by the &quot;force-carrying particles&quot;. It&#x27;s down there at the bottom. Even up here at massively higher levels, everything is fundamentally event-based.<p>If that&#x27;s the case, then why don&#x27;t we write entirely in terms of events as our base architecture? It isn&#x27;t because we are ignorant of event-based processing, it is because we <i>want</i> the other types of systems in our lives. Transactions don&#x27;t really exist; they are an abstraction we add to certain elements of the world that are behaviors they perform in response to certain types of incoming events. API calls don&#x27;t really exist, they are a stereotyped pattern of an event making a call and event sent back, tied to the first via some ID (which may be a TCP socket), with a response, and no further activity on that ID for that event, which is an abstraction we added on top of events for a certain very common type of call.<p>Working directly with event-based systems is the software architectural equivalent of writing in assembler. Sometimes you have to do it because nothing else will do. However, you are dropping to a lower level, with all that implies, particularly the fact that <i>you</i> are now responsible for any of those nice properties that you want to enforce. Very similar to how if you want to use UDP, but you want <i>some</i> of the guarantees of TCP, <i>you</i> are now responsible for those guarantees. There&#x27;s nothing wrong with that. It&#x27;s just something you need to be aware of in making your decisions.<p>Being the foundational architecture everything else is based on, event-based systems can do anything that is possible to do, again, quite similar to how assembler is what can do anything the CPU can do. The other abstractions function by providing limits on the event flows in the system for their power, again just as a higher-level language like C, or perhaps even more clearly Rust, simply can not be used to generate all possible assembler instruction sequences, because the way they fundamentally work is to exclude sequences from the set of all possible sequences to only contain sequences maintaining certain properties. Event-based systems <i>can</i> implement API-call-type sequences internally. Event-based systems <i>can</i> implement transactions by manually implementing all the requisite limitations of events and event ordering and what things do in response to events. Etc.<p>But, if you have a system that needs any of those guarantees, it&#x27;s kind of silly to start writing at an event-based level, only to have to painfully reconstruct the guarantees already available to you. As the Ancient Wisdom goes, &quot;Any sufficiently complicated event-based system contains an ad hoc, informally-specified, bug-ridden, slow implementation of half of TCP.&quot; Most of these abstractions are around for a reason.<p>Where things go wrong is when the abstractions become detached from their underlying implementation in people&#x27;s minds, and in their minds, become the base abstraction. Probably <i>the</i> single biggest instance in this space of that problem is treating &quot;the API call&quot; as &quot;the fundamental abstraction&quot;. API calls are an incredibly useful abstraction, but, at the same time, a really terrible primitive to be the bottom of your system. To build the API abstraction out of event flows involves throwing away a <i>lot</i> of the capabilities of events. If an API call is what you need, and it is a very common need, that&#x27;s a virtuous simplification, but when your needs exceed what an API call can do, you can really wreck up a design trying to implement an event system back on top of API calls. I&#x27;ve seen it at least twice in my career; one of the products I&#x27;m responsible for can almost literally be seen as a rewrite of a previous version that made that mistake in a manner that basically fatally killed it architecturally and replacing it with an event based system at the core... which I then immediately implement an API call layer on top of which <i>mostly</i> ran the system... but... right at the the critical place... didn&#x27;t, and I could reach back down the stack and use the raw event-based system in the core for a few critical bits of functionality.<p>This is my &quot;alternate point of view&quot;. Everything is already event-based, even when you can&#x27;t see it. However, that doesn&#x27;t mean it&#x27;s a good idea to work at that level of abstraction all the time any more than the fact CPUs run assembler means we should always be working in raw assembly code. It is not necessary to use raw events everywhere. It is not a betrayal of good design to have some API calls in your system, or a centralized transactional database, or even TCP (which most notably adds &quot;ordering&quot; to events). It <i>is</i>, however, necessary for software architects to understand that the event-based system underneath is fundamental, and that they view the other additional abstractions as islands of functionality based on the event-based core of the world underneath, and not confuse those islands with the bedrock. Many systems may not even expose event-based functionality at a raw level anywhere, but if you keep this principle in mind, if a raw-event use case ever pops up, your system will quite likely be ready to handle it.