Movatterモバイル変換


[0]ホーム

URL:


Skip to content
DEV Community
Log in Create account

DEV Community

Victor Dorneanu
Victor Dorneanu

Posted on • Originally published atblog.dornea.nu on

     

Hexagonal Architecture in Python

What do have clean, layered,hexagonal hexagonal, onion architecture and ports & adapters in common? They kind of share the same principles: Separation of concerns (business vs infrastructure code), data encapsulation (information hiding),low coupling, strict dependency flow (how layers should depend on other ones).

Still these concepts are not easy to digest unless you put them into practice. Furthermore architectural decisions are figured out based on personal, past experiences and the degree of knowledge people have when discussing viable solutions.

Figure 1: View presentation

Viewpresentation

As already mentioned inAccelerate architectural decissions and effective architecture enable teams to easily test and deploy individual components/services also when the organization grows or the amount of services changes. Architectural characteristics rather than implementation details were more important in order to have a portable and sustainable architecture. As you define (logical) layers, clear boundaries and relationships between individual packages/modules inside your software, this will improve overall maintainability and testability of your code.

Some months ago I gave a presentation on “Hexagonal Architecture in Python” for the TECH team atCashlink. More than a year ago, me and my ex-colleagues atScout24 were implementing small services using the same principles, but inGolang. At that time I’ve found it rather easy to find examples for Golang. ForPython I still miss examples of big projects embracing hexagonal architecture. (But maybe because I didn’t search as long as I did with Go … )

Inthis presentation I somehow mix “hexagonal architecture” and “ports & adapters” for architecting an application meant to upload documents to several storage systems (S3, Dropbox etc.) Let me know if you think this is useful and/or abstractions (as interfaces) are somehow obsolete in Python making code even unreadable.

Top comments(0)

Subscribe
pic
Create template

Templates let you quickly answer FAQs or store snippets for re-use.

Dismiss

Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment'spermalink.

For further actions, you may consider blocking this person and/orreporting abuse

I work as a Security Architect currently with focus on ETH. I mainly code in Golang, Python and TypeScript. I use (Doom) Emacs for almost everything and ORG mode for generating/publishing content.
  • Location
    Berlin
  • Work
    Security Architect / Software Engineer at SAP
  • Joined

More fromVictor Dorneanu

DEV Community

We're a place where coders share, stay up-to-date and grow their careers.

Log in Create account

[8]ページ先頭

©2009-2025 Movatter.jp