Vtome.ru - электронная библиотека

Clean Code Principles and Patterns, 2nd Edition : A Software Practitioner's Handbook

  • Добавил: literator
  • Дата: 12-04-2024, 06:27
  • Комментариев: 0
Название: Clean Code Principles and Patterns, 2nd Edition : A Software Practitioner's Handbook
Автор: Petri Silén
Издательство: Leanpub
Год: 2024-04-07
Страниц: 672
Язык: английский
Формат: pdf (true), epub
Размер: 61.4 MB

This book teaches you how to write clean code. It presents software design and development principles and patterns in a very practical manner. This book is suitable for both junior and senior developers. Some basic knowledge of programming in Python is required. All examples in this book are presented in Python, except some examples related to frontend code, which are in jаvascript/TypeScript. The content of this book is divided into ten chapters. All Python examples in this book require Python 3.11 or later. This is a book for primarily software developers. For that reason, some topics are not covered exhaustively. This includes topics related to architecture, DevSecOps, E2E, and non-functional testing. Those are topics most relevant to software architects, DevOps specialists and test/QA engineers. I want to cover them in this book because it is always good to have a basic understanding of topics closely related to software development.

This book presents a lot of principles, best practices, and patterns. It can be difficult to grasp them all on a single read, which is not the purpose. You should pick the most relevant topics for yourself, embrace them, and try to put them into use in everyday coding. You can always return to the book to learn additional topics. Some principles, patterns, and practices can be subjective and open for debate, but I have only put into this book such principles, patterns, and practices that I have used or would use myself. In the last Conclusion chapter, I will list the topics that I consider the most important based on my experience in real-life projects.

The second chapter is about architectural design principles that enable the development of true cloud-native microservices. The first architectural design principle described is the single responsibility principle, which defines that a piece of software should be responsible for one thing at its abstraction level. Then, a uniform naming principle for microservices, clients, APIs, and libraries is presented. The encapsulation principle defines how each software component should hide its internal state behind a public API. The service aggregation principle is introduced with a detailed explanation of how a higher-level microservice can aggregate lower-level microservices. Architectural patterns like event sourcing, command query responsibility segregation (CQRS), and distributed transactions are discussed. Distributed transactions are covered with examples using the saga orchestration pattern and the saga choreography pattern. You get answers on how to avoid code duplication at the architectural level. The externalized configuration principle describes how service configuration should be handled in modern environments. We discuss the service substitution principle, which states that dependent services a microservice uses should be easily substitutable. The importance of autopilot microservices is discussed from the point of view of statelessness, resiliency, high availability, observability, and automatic scaling. Towards the end of the chapter, there is a discussion about different ways microservices can communicate. Several rules are presented on how to version software components. The chapter ends with discussing why limiting the number of technologies used in a software system is helpful.

The third chapter presents object-oriented design principles. We start the chapter with object-oriented programming concepts and programming paradigms followed by the SOLID principles: Single responsibility principle, open-closed principle, Liskov’s substitution principle, interface segregation principle, and dependency inversion principle. Each SOLID principle is presented with realistic but simple examples. The uniform naming principle defines a uniform way to name interfaces, classes, functions, function pairs, boolean functions (predicates), builder, factory, conversion, and lifecycle methods. The encapsulation principle describes that a class should encapsulate its internal state and how immutability helps ensure state encapsulation. The encapsulation principle also discusses the importance of not leaking an object’s internal state out. The object composition principle defines that composition should be preferred over inheritance. Tactical Domain-driven design (DDD) is presented with two real-world examples. All the design patterns from the GoF’s Design Patterns book are presented with realistic yet straightforward examples. The don’t ask, tell principle is presented as a way to avoid the feature envy design smell. The chapter also discusses avoiding primitive obsession and the benefits of using semantically validated function arguments. The chapter ends by presenting the dependency injection principle and avoiding code duplication principle. The fourth chapter is about coding principles. The chapter starts with a principle for uniformly naming variables in code. A uniform naming convention is presented for integer, floating-point, boolean, string, enum, and collection variables.

The book is divided into ten chapters:

Architectural design principles
Object-oriented design principles
Coding principles
Testing principles
Security principles
API design principles
Database types and related principles
Concurrent programming principles
Agile and teamwork principles
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 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
What is clean (or hexagonal) architecture and 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
Strategic and tactical domain-driven design (DDD) with examples
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
Most important refactoring techniques for everyday use
Why you should use a statically typed language
How to correctly handle errors and exceptions
How to not forget handle errors and exceptions
Why you should never pass or return a null value
How to avoid off-by-one errors effectively
What you should remember when using a Google search to get answers
When and how to optimize code
TDD, Detroit/Chicago vs. London schools, 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, key-value store, or wide-column database
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, and continuous integration (CI), and what is the difference between continuous delivery (CD) and continuous deployment (CD). Examples with Docker, Kubernetes and GitHub Actions.

Скачать Clean Code Principles and Patterns, 2nd Edition : A Software Practitioner's Handbook



ОТСУТСТВУЕТ ССЫЛКА/ НЕ РАБОЧАЯ ССЫЛКА ЕСТЬ РЕШЕНИЕ, ПИШИМ СЮДА!











ОТСУТСТВУЕТ ССЫЛКА/ НЕ РАБОЧАЯ ССЫЛКА ЕСТЬ РЕШЕНИЕ, ПИШИМ СЮДА!


ПРАВООБЛАДАТЕЛЯМ


СООБЩИТЬ ОБ ОШИБКЕ ИЛИ НЕ РАБОЧЕЙ ССЫЛКЕ



Внимание
Уважаемый посетитель, Вы зашли на сайт как незарегистрированный пользователь.
Мы рекомендуем Вам зарегистрироваться либо войти на сайт под своим именем.
Информация
Посетители, находящиеся в группе Гости, не могут оставлять комментарии к данной публикации.