Email the Author

You can use this page to email Petri Silen about Clean Code Principles And Patterns.

Please include an email address so the author can respond to your query

This message will be sent to Petri Silen

This site is protected by reCAPTCHA and the Google  Privacy Policy and  Terms of Service apply.

About the Book

There is also a Java/JavaScript/TypeScript (a couple of examples also in C++) edition of this book available: https://leanpub.com/cleancodeprinciplesandpatterns

Paperback version of the book is available on Amazon.

 

Clean Code Principles and Patterns: Python Edition is one of the most comprehensive no-fluff guides for Python software developers to help them write clean code every day. The author, Petri Silén, has almost 30 years of industry experience in designing and implementing software, and now he puts all his knowledge gained during the years into this book. The book is packed with principles and patterns that help developers, from novices and juniors to seniors and experts, to write cleaner code. The principles and patterns presented in the book are accompanied by realistic yet straightforward examples to help the reader understand them better. The reader should have basic knowledge of Python programming language to get the full benefit from this book. Also, having basic knowledge of Docker and Kubernetes concepts is beneficial. The source code for all major examples presented in the book is available in a public GitHub repository.

 

The book is divided into ten chapters:

  1. Architectural design principles
  2. Object-oriented design principles
  3. Coding principles
  4. Testing principles
  5. Security principles
  6. API design principles
  7. Database types and related principles
  8. Concurrent programming principles
  9. Agile and teamwork principles
  10. DevSecOps

After reading this book, you will know the following and much more:

  • How to architect modern cloud-native microservices (examples with Kubernetes)
  • What are autopilot microservices
  • What are event sourcing, CQRS, distributed transactions, saga orchestration pattern, and saga choreography pattern
  • What are the main concepts of object-oriented programming
  • What are the different programming paradigms (imperative, functional, OO)
  • What are the five SOLID principles, and how to put them into use in real-life code
  • What are the 25 design patterns, and how to use them
  • Law of Demeter, Tell, don't ask principle, YAGNI, primitive obsession
  • What is the MVC pattern, and how MVP and MVVM differ from each other
  • How to achieve a clean design for a microservice (hexagonal/clean architecture). What is a vertical slice architecture
  • Why and how to use dependency injection
  • Detailed instructions with concrete examples on how to uniformly name various software entities like classes, functions, and variables
  • Why you should prefer composition over inheritance
  • Strategical and tactical domain driven design (DDD)
  • How to organize a source code repository
  • How to organize code into directories
  • Concrete ways how to avoid writing comments and refactor comments away
  • What are the most common issues that static code analyzers find, and how to correct them
  • Typical code smells and refactoring techniques to solve them
  • Why you should use type annotations
  • How to correctly handle errors and exceptions
  • How not to forget to handle errors and exceptions
  • How to avoid off-by-one errors effectively
  • What you should remember when using a Google search or Generative AI like ChatGPT to get answers
  • When and how to optimize code
  • TDD, London vs. Detroit/Chicago schools, BDD, ATDD, unit testing, mocking, integration testing, E2E testing, and non-functional testing
  • What is threat modeling and how to conduct it
  • Authentication and authorization using OpenID Connect and OAuth2
  • What are the essential security features to implement in an application
  • How to design APIs using technologies like JSON-RPC, REST, GraphQL, SSE, WebSocket, gRPC, and event-driven services
  • When and how to use a relational database, document database (MongoDB), key-value store (Redis), or wide-column database (Cassandra)
  • How to avoid SQL injection attacks using ORM or parameterized SQL queries
  • When to use threading or parallel algorithms and how to ensure thread safety
  • What principles to follow when working in a software development team
  • What are DevOps, SecOps, containerization, and continuous integration (CI). What is the difference between continuous delivery (CD) and continuous deployment (CD). What is observability. Some examples of Docker, Kubernetes and GitHub Actions.
  • And much more

About the Author

Petri Silen’s avatar Petri Silen

@silen_petri

Petri Silén is a seasoned software developer working at Nokia Networks in Finland with industry experience of almost 30 years. He has done both frontend and backend development with a solid competence in multiple programming languages, including C++, Java, Python and JavaScript/TypeScript. He started his career at Nokia Telecommunications in 1995. During his first years, he developed a real-time mobile networks analytics product called "Traffica" in C++ for major telecom customers worldwide, including companies like T-Mobile, Orange, Vodafone, and Claro. The initial product was for monitoring a 2G circuit-switched core network and GPRS packet-switched core network. Later, functionality to Traffica was added to cover new network technologies, like 3G circuit-switched and packet core networks, 3G radio networks, and 4G/LTE. He later developed new functionality for Traffica using Java and web technologies, including jQuery and React. During the last few years, he has developed cloud-native containerized microservices with Java and C++ for the next-generation Customer and Networks Insights CNI) product used by major communications service providers like Verizon, AT&T, USCC, and KDDI. The main application areas he has contributed during the last years include KPI-based real-time alerting, anomaly detection for KPIs, and configurable real-time data exporting.

During his free time, he has developed a data visualization application using React, Redux, TypeScript, and Jakarta EE. He has also developed a security-first cloud-native microservice framework for Node.js in TypeScript. He likes to take care of his Kaapo cat, take walks, play tennis and badminton, ski in the winter, and watch soccer and ice hockey on TV.

Logo white 96 67 2x

Publish Early, Publish Often

  • Path
  • There are many paths, but the one you're on right now on Leanpub is:
  • Cleancodeprinciplesandpatternspythonedition › Email Author › New
    • READERS
    • Newsletters
    • Weekly Sale
    • Monthly Sale
    • Store
    • Home
    • Redeem a Token
    • Search
    • Support
    • Leanpub FAQ
    • Leanpub Author FAQ
    • Search our Help Center
    • How to Contact Us
    • FRONTMATTER PODCAST
    • Featured Episode
    • Episode List
    • MEMBERSHIPS
    • Reader Memberships
    • Department Reader Memberships
    • Author Memberships
    • Your Membership
    • COMPANY
    • About
    • About Leanpub
    • Blog
    • Contact
    • Press
    • Essays
    • AI Services
    • Imagine a world...
    • Manifesto
    • More
    • Partner Program
    • Causes
    • Accessibility
    • AUTHORS
    • Write and Publish on Leanpub
    • Create a Book
    • Create a Bundle
    • Create a Course
    • Create a Track
    • Testimonials
    • Why Leanpub
    • Services
    • TranslateAI
    • TranslateWord
    • TranslateEPUB
    • PublishWord
    • Publish on Amazon
    • CourseAI
    • GlobalAuthor
    • Marketing Packages
    • IndexAI
    • Author Newsletter
    • The Leanpub Author Update
    • Author Support
    • Author Help Center
    • Leanpub Authors Forum
    • The Leanpub Manual
    • Supported Languages
    • The LFM Manual
    • Markua Manual
    • API Docs
    • Organizations
    • Learn More
    • Sign Up
    • LEGAL
    • Terms of Service
    • Copyright Policy
    • Privacy Policy
    • Refund Policy

*   *   *

Leanpub is copyright © 2010-2025 Ruboss Technology Corp.
All rights reserved.

This site is protected by reCAPTCHA
and the Google  Privacy Policy and  Terms of Service apply.

Leanpub requires cookies in order to provide you the best experience. Dismiss