Skip to product information
Python Architectural Patterns
Python Architectural Patterns
Description
Book Introduction
This book provides a comprehensive guide to designing and maintaining large-scale software systems, emphasizing scalability, adaptability, and best practices using the Python language.
Covers essential topics including software architecture, API design, data modeling, and the 12-factor app methodology.
Each chapter delves into web server architecture, event-driven architecture, microservices and monoliths, testing methodologies, package management, and ongoing maintenance.
It will also help you prepare for developer interviews.
  • You can preview some of the book's contents.
    Preview

index
Chapter 1.
Introduction to Software Architecture


__Definition of system structure
__divide into smaller units
____Interprocess Communication
Conway's Law: Its Impact on Software Architecture
__Application Example: Overview
__Security Aspects of Software Architecture
summation

Part 1.
design

Chapter 2. API Design


__abstract
____Use the right abstraction
____Leak abstraction
____Resource and Action Abstraction
__RESTful interface
____A more practical definition
____HTTP headers and status codes
____Resource Design
____Resources and Parameters
____pagination
____RESTful API process design
____Use the Open API specification
__certification
____HTML Interface Authentication
____RESTful interface authentication
__API version management
____Why do we use version control?
____Internal and external version control
____Semantic Versioning
____Simplified version control
__Frontend and Backend
____Model-View-Controller Structure
__HTML interface
____Existing HTML interface
____Dynamic Pages
____Single-page application
____Hybrid Approach
__API design example
____endpoint
____Design and Implementation Review
summation

Chapter 3.
Data Modeling


__Database Type
____relational database
____Non-relational database
____small database
__Database Transaction
__Distributed Relational Database
____Original/Copy
____sharding
Advantages and Disadvantages of ____sharding
__Schema Design
____Schema Normalization
____Denormalization
__Data Indexing
____cardinality
summation

Chapter 4.
data layer


__model layer
____Domain-Driven Design
Using ____ORM
____Unit of Work Pattern and Data Encapsulation
____CQRS using different models for reading and writing
__Database Migration
____Backward compatibility
____Relational schema changes
Changes that do not apply the ____ schema
__Handling legacy databases
Detect schema in ____database
____Synchronize existing schema to ORM definition
summation

Part 2.
architectural patterns

Chapter 5.
Twelve-Factor App Methodology


Introducing the Twelve-Factor App
__Continuous Integration (CI)
__Scalability
__setting
__Elements of the Twelve-Factor App
____Build once, run many times
____Dependencies and Settings
____Scalability
____Monitoring and Admin
__Twelve-Factor App Containerization
summation

Chapter 6.
Web server architecture


__Request-Response
__Web Architecture
__web server
Serving static files externally
____Reverse Proxy
____Save log
____Advanced Usage
__uWSGI
____WSGI application
Interacting with ____web servers
____process
____process life cycle
__Python Worker
____Django MVT Architecture
Routing requests to ____view
____views
____middleware
____Django REST Framework
__Outer layer
summation

Chapter 7.
Event-based architecture


__Event delivery
__Asynchronous tasks
__Task breakdown
__Schedule tasks
__Q's effect
____Single code for all workers
____Cloud Queues and Workers
__Celery
____Celery Settings
____Celery Walker
____Trigger Action
____task, connecting workers
____Schedule work
____Celery Flower
____Flower HTTP API
summation

Chapter 8.
Advanced event-based architecture


__Streaming Event
__pipeline
____preparation
____Basic tasks
____Image Operations
____Video work
____Task Connection
Execute ____task
__Defining a bus
__More complex systems
__Event-driven system testing
summation

Chapter 9.
Microservices vs. Monoliths


__Monolith Architecture
__Microservices architecture
__Choose architecture
____References to similar designs
__Key Element: Team Communication
__Migration from Monolith to Microservices
____Migration Challenges
Four Considerations When Migrating ____
__Service Containerization
Build and run the ____image
____Build and run the web service
__Orchestration and Kubernetes
summation

Part 3.
avatar

Chapter 10.
Testing and TDD


__Code Test
__Tests at various levels
____unit test
____Integration Testing
____System Test
__Testing Philosophy
____How to Design Great Tests
____Structured Testing
__Test-Driven Development
____Introducing TDD to a new team
____Issues and Limitations
____TDD process example
__Introducing Unit Testing in Python
____Python unittest
____pytest
__External Dependency Testing
____Mocking
____Dependency Injection
Dependency Injection in ____OOP
__pytest advanced features
____group test
Use ____fixture
summation

Chapter 11.
Package Management


__Creating a new package
__General packaging in Python
__Python package ecosystem
____PyPI
____virtual environment
____environmental preparation
____Python package
__Create a package
____Development Mode
____Pure Python package
__Cython
__Python package containing binary code
__Uploading packages to PyPI
__Create your own private index
summation

Part 4.
Ongoing operational work

Chapter 12.
Logging


__Log basic contents
__Generating logs in Python
__Detecting problems through logs
____Expected error detected
____Collecting unexpected errors
__Log strategy
__Add log during development
__Log limit
summation

Chapter 13.
Metric


__metrics and logs
____metric type
__Creating metrics using Prometheus
____environment preparation
____Django Prometheus Settings
Check ____metrics
____Start Prometheus server
__Prometheus query
Working proactively with __metrics
__warning
summation

Chapter 14.
Profiling


__Profiling Basics
__Profiler Type
__Profiling code that tells you how long it takes
____Using the built-in cProfile module
____line profiler
__Partial profiling
Example of a web server that returns ____decimal numbers
____Full process profiling
____Generate profiling files for each request
__Memory Profiling
Using ____memory_profiler
____Memory optimization
summation

Chapter 15.
Debugging


__Defect detection and handling
__Production Environment Analysis
__Understanding the challenges of a production environment
____Request ID Logging
____Data Analysis
Added ____logging
__Local environment debugging
__Python introspection tool
Debugging with __log
Debugging using breakpoints
summation

Chapter 16.
Sustainable Architecture


__Architecture Improvement
__Scheduled Downtime
____Maintenance time
__obstacle
____Postmortem Analysis
____Primortem Analysis
__Load Testing
__version control
__Backward compatibility
____Incremental change
____Uninterrupted distribution
__feature flag
__Teamwork Aspects of Change
__summation

Detailed image
Detailed Image 1

Publisher's Review
◈ What this book covers ◈

Think like a software architect and analyze software architecture patterns.
◆ Examining API design, data storage, and data representation methods
◆ Examining the subtle differences in common architectural structures
◆ Leverage and interact with patterns such as microservices
◆ Implementing Test-Driven Development (TDD) to Perform Quality Code Testing
◆ Examining code that can be reconfigured into a package
Maintaining backward compatibility with previous versions and deploying sequential changes

◈ Target audience of this book ◈

This book is for software developers, regardless of experience, who want to expand and solidify their intuition about complex systems, who want to learn and grow, and who want to expand their knowledge of software architecture.

This book uses code written in Python as examples.
You don't need to be a Python expert, but I assume you have basic knowledge of Python.

◈ Structure of this book ◈

Chapter 1, "Introduction to Software Architecture," presents the topic of what software architecture is and why it is useful, and introduces design cases.
Part 1 of this book describes the design phase before writing software.
Chapter 2, "API Design," covers the fundamentals of designing useful APIs that can conveniently abstract tasks.
Chapter 3, "Data Modeling," explains the characteristics of storage systems and how to appropriately design data representation in applications.
Chapter 4, "Data Layer," explains the code that processes stored data and how to create data for specific purposes.
Part 2 covers various architectural patterns that reuse proven structures.
Chapter 5, "The Twelve-Factor App Methodology," presents good practices that are useful not only when applying the Twelve-Factor App Methodology to web services, but can also be used in a variety of situations.
Chapter 6, "Web Server Architecture," describes web services and various factors to consider when deciding on service operation and software design.
Chapter 7, "Event-Driven Architectures," explores systems that receive responses asynchronously rather than returning an immediate response.
Chapter 8, "Advanced Event-Based Architectures," covers advanced uses of asynchronous systems and the various patterns they can create.
Chapter 9, "Microservices vs. Monoliths," presents two architectures for solving complex systems and explains their differences.
In Part 3, we will look at how to write code like this:
Chapter 10, "Testing and TDD," explains the fundamentals of testing and how test-driven development (TDD) can be used in the coding process.
Chapter 11, "Package Management," covers the process of creating reusable pieces of code and how to deploy them.
Part 4 describes the tasks that require monitoring for improvements and changes while the system is operating.
Chapter 12, "Logging," looks at how to log the work your job system performs.
Chapter 13, "Metrics," explains how to aggregate various values ​​to see how the overall system is performing.
Chapter 14, "Profiling," provides an easy way to learn how to write code that can improve performance.
Chapter 15, "Debugging," introduces the process of finding and fixing errors during code execution.
Chapter 16, "Continuous Architecture," explains how to successfully implement architectural changes in a running system.

◈ Author's Note ◈

As time goes by, software continues to evolve, which means systems become more complex, require more developers, and require developers to work in a set way.
As software grows in size, structures are typically created to fit the size.
So if you don't plan your structure well, it can get really confusing and difficult to work with.

The task of software architecture is to plan and design the structure.
A well-designed architecture allows multiple teams to interact with each other while maintaining a clear understanding of their responsibilities and goals.

The architecture of the system should be designed to enable the development of routine software at a level of care that allows for good operation.
So, we need to be able to add features to the system and expand the system.
The architecture of a production system is also always fluid and adaptable.
It is also extensible, allowing for the reconfiguration of various software elements in a deliberate and smooth manner.

◈ Translator's Note ◈

According to the 2023 Language Rankings (https://bit.ly/3WwvotY) published annually by GitHub, Python has been in third place since 2015 and in second place since 2019.
As can be seen from the language rankings, Python has a low barrier to entry for programming due to its easy syntax, readability, and conciseness, and anyone can easily and quickly do the programming they want, so it is used in various fields such as web servers and machine learning.

In fact, the translator also primarily uses Java or JVM-based languages, but the second most used language is Python.
I use it when coding Python as a script instead of Bash, and I often use it when coding on web frameworks such as Airflow, Flask, and FastAPI.
As a practitioner, the architectural patterns introduced in this book feel very natural.
This book contains useful information to know in advance.

It also provides a lot of understanding of how Python open source solutions work, as well as the knowledge you can gain while programming.
That is, it comprehensively covers everything from the basics to advanced topics in software architecture.
But don't be afraid, you don't need to have expert-level knowledge of Python.

I believe this book will provide a good guide for those who want to develop good architecture.
I hope you enjoy coding.
Here's a tip: It might help to ask architecture-related questions during a face-to-face interview.
GOODS SPECIFICS
- Date of issue: August 28, 2024
- Page count, weight, size: 692 pages | 1,292g | 188*235*32mm
- ISBN13: 9791161758640
- ISBN10: 116175864X

You may also like

카테고리