DEV Community

Bertil Muth
Bertil Muth

Posted on

Architectural styles

Which architectural styles are you using in your applications?
I am thinking of monolithic, client-server, event-driven, service oriented and the like.

What made you chose the style? In the context of which kind of applications? What are your experiences with it?

Top comments (2)

Collapse
 
kspeakman profile image
Kasey Speakman • Edited

I think the core theme of my recent arch style has been Messaging. For APIs, request/reply has been Command or Query messages. For integration or data propagation, it has been Event messages. Inside an API I also use messaging. Domain logic doesn't perform side effects, instead it creates a message (Event) that something happened. Then later in the request pipeline some integration is responsible for storing that message, whether event sourcing or translating to a relational source of truth. And even later -- in same process if monolithic, or separate service if more distributed -- the same message may trigger integrations with some other system, like sending an email or calling a 3rd party API.

Messaging permeates the client side as well, where I have been using Elm and the MVU pattern. There, messages (Events really) are the only mechanism by which you know something has happened in the app, whether it be user input or HTTP responses. One of the 2 key types you must create for MVU is the Msg type. (Really it should be called MMVU for the 4 key parts: Model type, Msg type, View function, Update function)

How did I arrive at messaging? That's harder to say. I think it started when I discovered event sourcing. At first my mind was blown at the idea of storing a complex object as a series of events. Then it was blown again with the idea that the business events are actually the important part, and the complex object was ephemeral. I still recall reading a post by Jonathan Oliver where he rated messaging as the most impactful pattern he has used. This stood out to me, because at the time I was more interested in the other patterns he mentioned. His post didn't sway me to focus on messaging, but I never forgot it. And as I have gained experience, messaging has seemingly naturally taken a prominent role in my code. I guess you could even look at functional programming as just a series of transformations on a data "message", then IO "integration" happens based on the result of those transformations.

Collapse
 
bertilmuth profile image
Bertil Muth

I can fully relate to what you are saying - event-driven/event-sourced applications have some fascinating properties. Thanks for sharing.