Clean Architectures in Python by Leonardo Giordani

Size: 2 MB (1845516 bytes) Extension: pdf

$5.00

Categories: , Tag: GTIN: 008999976723
Clean Architectures in Python
Size: 2 MB (1845516 bytes) Extension: pdf
Author(s): Leonardo Giordani

Publisher: Leanpub, Year: 2018

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.

To fully appreciate the book you need to know Python and be familiar with TDD, in particular with unit testing and mocks. Please refer to the series TDD in Python with pytest published on my blog if you need to refresh your knowledge about these topics.

After the two introductory parts that you are reading,

chapter 1 goes through a 10,000 feet overview of a system designed with a clean architecture, while c

hapter 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.

 

Table of contents :
Table of Contents……Page 5
Introduction……Page 8
What is a software architecture?……Page 9
Why is it called “clean” architecture?……Page 10
Acknowledgments……Page 11
A brief history of this book……Page 12
Why this book comes for free……Page 13
About the author……Page 14
Virtual environments……Page 15
Python projects with Cookiecutter……Page 16
Part 1 – Tools……Page 18
A real-life example……Page 19
Setup the project……Page 21
Step 1 – Adding two numbers……Page 22
Step 2 – Adding three numbers……Page 27
Step 3 – Adding multiple numbers……Page 31
Step 4 – Subtraction……Page 33
Step 5 – Multiplication……Page 34
Step 6 – Refactoring……Page 38
Step 7 – Division……Page 39
Step 8 – Testing exceptions……Page 41
Step 9 – A more complex set of requirements……Page 42
Recap of the TDD rules……Page 51
How to manage bugs or missing features……Page 52
Tests should be idempotent……Page 54
External systems……Page 55
Focus on messages……Page 56
The testing grid……Page 57
Conclusions……Page 59
First steps……Page 60
Simple return values……Page 61
Complex return values……Page 62
Asserting calls……Page 64
A simple example……Page 66
Patching……Page 70
The patching decorator……Page 73
Multiple patches……Page 74
Patching immutable objects……Page 76
A warning……Page 79
Recap……Page 80
Part 2 – The clean architecture……Page 81
Main layers……Page 82
APIs and shades of grey……Page 84
Project overview……Page 85
Domain models……Page 86
Serializers……Page 90
Use cases……Page 91
The storage system……Page 94
A command line interface……Page 96
HTTP API……Page 99
Conclusions……Page 107
Introduction……Page 108
Basic requests and responses……Page 109
Requests and responses in a use case……Page 110
Request validation……Page 112
Responses and failures……Page 117
Error management in a use case……Page 124
The HTTP server……Page 127
The repository……Page 131
Conclusions……Page 135
Introduction……Page 136
A repository based on PostgreSQL……Page 137
A repository based on MongoDB……Page 156
Conclusions……Page 169
Part 3 – Appendices……Page 170
Changelog……Page 171

Stay Connected

We don’t spam! Read our privacy policy for more info.

Shopping Cart