Clean Architectures in Python

This document was uploaded by one of our users. The uploader already confirmed that they had the permission to publish it. If you are author/publisher or own the copyright of this documents, please report to us by using this DMCA report form.

Simply click on the Download Book button.

Yes, Book downloads on Ebookily are 100% Free.

Sometimes the book is free on Amazon As well, so go ahead and hit "Search on Amazon"

Author(s): Leonardo Giordani
Publisher: Leanpub
Year: 2018

Language: English
Pages: 171

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