this post was submitted on 17 Jun 2023
15 points (100.0% liked)

Programming

13373 readers
1 users here now

All things programming and coding related. Subcommunity of Technology.


This community's icon was made by Aaron Schneider, under the CC-BY-NC-SA 4.0 license.

founded 1 year ago
MODERATORS
 

I looked into the lemmy src, and what is supposed to be a CRUD API has several layers of abstraction. Same at work, where we have hexagonally structured apps where following any sort of logic is literally impossible. What are your thoughts?

you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 12 points 1 year ago (5 children)

mind if i ask what 'hexagonally structured' means? i have never heard of this and cant imagine what it could be :D

[–] [email protected] 5 points 1 year ago (1 children)

The hexagonal architecture or onion architecture is oversimplified as having everything bolt onto a core of business logic via designed and designated interfaces to abstract away implementation details on either side.

Say you have a web app which takes requests from the outside world and based on those requests it performs some business logic (tracking accounts, orders, etc).

In hexagonal architecture you'd maybe implement such a thing like:

Web app handler -> command interface -> message bus -> command handler (business logic) -> repository interface -> repository (Postgres, mongo, memory, email)

What this lets you do is split apart the app at the interfaces into separate modules which can be reasoned about and tested separately.

End of the day you don't care what is happening on the other side of the interface as long as whatever it is follows the interface specification.

Building applications like this meants that if we wanted to extend our app with an API and a Real-time Websocket service, we can (usually) just write a handler to turn that request into a command for the command interface and be done with it.

[–] [email protected] 3 points 1 year ago (1 children)

cool, thanks for the explanation :) i am familiar with onion architecture, i just never heard of hexagonal arch. i assumed there would be some difference

[–] [email protected] 1 points 1 year ago

Assuming I'm remembering correctly, they're both very similar. To the point that they're basically the same concept by different sources and therefore have some wiggle in interpretation

load more comments (3 replies)