DEV Community

Cover image for Clean Architectures in Python
Leonardo Giordani
Leonardo Giordani

Posted on

4

Clean Architectures in Python

The clean architecture is the opposite of spaghetti code, where everything is interlaced and there are no single elements that can be easily detached from the rest and replaced without the whole system collapsing. The main point of the clean architecture is to make clear "what is where and why", and this should be your first concern while you design and implement a software system, whatever architecture or development methodology you want to follow.

In 2018 I wrote the free book "Clean Architectures in Python" and published it on Leanpub because I wanted to help fellow developers to understand some concepts behind software architecture design, and in particular behind the Clean Architecture popularised by Robert Martin in recent years. In 2020 I published the second edition with revised code and an additional chapter. The book has been a great success and has been downloaded by more that 16000 readers so far!

After two introductory parts, chapter 1 goes through a 10,000 feet overview of a system designed with a clean architecture, while chapter 2 briefly discusses the components and the ideas behind this software architecture. Chapter 3 runs through a concrete example of clean architecture and chapter 4 expands the example adding a web application on top of it. Chapter 5 discusses error management and improvements to the Python code developed in the previous chapters. Chapters 6 and 7 show how to plug different database systems to the web service created previously, and chapter 8 wraps up the example showing how to run the application with a production-ready configuration.

You can read the book online at https://www.thedigitalcatbooks.com/ or download the PDF at https://leanpub.com/clean-architectures-in-python/. The PDF can be downloaded for free, but any contribution is welcome and will help me to create more quality content. Please also share this with friends or other people you think might be interested in the topic.

I hope you enjoy the book!

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

Top comments (0)

AWS Security LIVE!

Tune in for AWS Security LIVE!

Join AWS Security LIVE! for expert insights and actionable tips to protect your organization and keep security teams prepared.

Learn More

👋 Kindness is contagious

Immerse yourself in a wealth of knowledge with this piece, supported by the inclusive DEV Community—every developer, no matter where they are in their journey, is invited to contribute to our collective wisdom.

A simple “thank you” goes a long way—express your gratitude below in the comments!

Gathering insights enriches our journey on DEV and fortifies our community ties. Did you find this article valuable? Taking a moment to thank the author can have a significant impact.

Okay