دسترسی نامحدود
برای کاربرانی که ثبت نام کرده اند
برای ارتباط با ما می توانید از طریق شماره موبایل زیر از طریق تماس و پیامک با ما در ارتباط باشید
در صورت عدم پاسخ گویی از طریق پیامک با پشتیبان در ارتباط باشید
برای کاربرانی که ثبت نام کرده اند
درصورت عدم همخوانی توضیحات با کتاب
از ساعت 7 صبح تا 10 شب
ویرایش: 3
نویسندگان: Kamon Ayeva
and Sakis Kasampalis
سری:
ISBN (شابک) : 9781837639618
ناشر: Packt Publishing Pvt Ltd
سال نشر: 2024
تعداد صفحات: 0
زبان: English
فرمت فایل : EPUB (درصورت درخواست کاربر به PDF، EPUB یا AZW3 تبدیل می شود)
حجم فایل: 3 مگابایت
در صورت تبدیل فایل کتاب Mastering Python Design Patterns: Craft essential Python patterns by following core design principles, 3rd Edition به فرمت های PDF، EPUB، AZW3، MOBI و یا DJVU می توانید به پشتیبان اطلاع دهید تا فایل مورد نظر را تبدیل نمایند.
توجه داشته باشید کتاب تسلط بر الگوهای طراحی پایتون: الگوهای ضروری پایتون را با پیروی از اصول طراحی اصلی بسازید، ویرایش سوم نسخه زبان اصلی می باشد و کتاب ترجمه شده به فارسی نمی باشد. وبسایت اینترنشنال لایبرری ارائه دهنده کتاب های زبان اصلی می باشد و هیچ گونه کتاب ترجمه شده یا نوشته شده به فارسی را ارائه نمی دهد.
Mastering Python Design Patterns
Contributors
About the authors
About the reviewers
Preface
Who this book is for
What this book covers
To get the most out of this book
Download the example code files
Conventions used
Most of the code has been automatically formatted
The code snippets in the book’s pages may be shortened
Other conventions
Get in touch
Share your thoughts
Download a free PDF copy of this book
Part 1: Start with Principles
1
Foundational Design Principles
Technical requirements
Following the Encapsulate What Varies principle
What does it mean?
Benefits
Techniques for achieving encapsulation
An example – encapsulating using polymorphism
An example – encapsulating using a property
Following the Favor Composition Over Inheritance principle
What does it mean?
Benefits
Techniques for composition
An example – compose a car using the engine
Following the Program to Interfaces, Not Implementations principle
What does it mean?
Benefits
Techniques for interfaces
An example – different types of logger
An example – different types of logger, now using Protocols
Following the Loose Coupling principle
What does it mean?
Benefits
Techniques for loose coupling
An example – a message service
Summary
2
SOLID Principles
Technical requirements
SRP
An example of software design following the SRP
OCP
An example of design following the OCP
LSP
An example of design following the LSP
ISP
An example of design following the ISP
DIP
An example of design following the ISP
Summary
Part 2: From the Gang of Four
3
Creational Design Patterns
Technical requirements
The factory pattern
The factory method
The abstract factory pattern
The builder pattern
Real-world examples
Comparison with the factory pattern
Use cases for the builder pattern
Implementing the builder pattern
The prototype pattern
Real-world examples
Use cases for the prototype pattern
Implementing the prototype pattern
The singleton pattern
Real-world examples
Use cases for the singleton pattern
Implementing the singleton pattern
Should you use the singleton pattern?
The object pool pattern
Real-world examples
Use cases for the object pool pattern
Implementing the object pool pattern
Summary
4
Structural Design Patterns
Technical requirements
The adapter pattern
Real-world examples
Use cases for the adapter pattern
Implementing the adapter pattern – adapt a legacy class
Implementing the adapter pattern – adapt several classes into a unified interface
The decorator pattern
Real-world examples
Use cases for the decorator pattern
Implementing the decorator pattern
The bridge pattern
Real-world examples
Use cases for the bridge pattern
Implementing the bridge pattern
The facade pattern
Real-world examples
Use cases for the facade pattern
Implementing the facade pattern
The flyweight pattern
Real-world examples
Use cases for the flyweight pattern
Implementing the flyweight pattern
The proxy pattern
Real-world examples
Use cases for the proxy pattern
Implementing the proxy pattern – a virtual proxy
Implementing the proxy pattern – a protection proxy
Implementing the proxy pattern – a remote proxy
Implementing the proxy pattern – a smart proxy
Summary
5
Behavioral Design Patterns
Technical requirements
The Chain of Responsibility pattern
Real-world examples
Use cases for the Chain of Responsibility pattern
Implementing the Chain of Responsibility pattern
The Command pattern
Real-world examples
Use cases for the Command pattern
Implementing the Command pattern
The Observer pattern
Real-world examples
Use cases for the Observer pattern
Implementing the Observer pattern
The State pattern
Real-world examples
Use cases for the State pattern
Implementing the State pattern
The Interpreter pattern
Real-world examples
Use cases for the Interpreter pattern
Implementing the Interpreter pattern
The Strategy pattern
Real-world examples
Use cases for the Strategy pattern
Implementing the Strategy pattern
The Memento pattern
Real-world examples
Use cases for the Memento pattern
Implementing the Memento pattern
The Iterator pattern
Use cases for the Iterator pattern
Implementing the Iterator pattern
The Template pattern
Real-world examples
Use cases for the Template pattern
Implementing the Template pattern
Other behavioral design patterns
Summary
Part 3: Beyond the Gang of Four
6
Architectural Design Patterns
Technical requirements
The MVC pattern
Real-world examples
Use cases for the MVC pattern
Implementing the MVC pattern
The Microservices pattern
Real-world examples
Use cases for the Microservices pattern
Implementing the microservices pattern – a payment service using gRPC
Implementing the microservices pattern – an LLM service using Lanarky
The Serverless pattern
Real-world examples
Use cases for the Serverless pattern
Implementing the Serverless pattern
The Event Sourcing pattern
Real-world examples
Use cases for the Event Sourcing pattern
Implementing the event sourcing pattern – the manual way
Implementing the Event Sourcing pattern – using a library
Other architectural design patterns
Summary
7
Concurrency and Asynchronous Patterns
Technical requirements
The Thread Pool pattern
Real-world examples
Use cases for the Thread Pool pattern
Implementing the Thread Pool pattern
The Worker Model pattern
Real-world examples
Use cases for the Worker Model pattern
Implementing the Worker Model pattern
The Future and Promise pattern
Real-world examples
Use cases for the Future and Promise pattern
Implementing the Future and Promise pattern – using concurrent.futures
Implementing the Future and Promise pattern – using asyncio
The Observer pattern in reactive programming
Real-world examples
Use cases for the Observer pattern in reactive programming
Implementing the Observer pattern in reactive programming
Other concurrency and asynchronous patterns
Summary
8
Performance Patterns
Technical requirements
The Cache-Aside pattern
Real-world examples
Use cases for the cache-aside pattern
Implementing the cache-aside pattern
The Memoization pattern
Real-world examples
Use cases for the memoization pattern
Implementing the memoization pattern
The Lazy Loading pattern
Real-world examples
Use cases for the lazy loading pattern
Implementing the lazy loading pattern – lazy attribute loading
Implementing the lazy loading pattern – using caching
Summary
9
Distributed Systems Patterns
Technical requirements
The Throttling pattern
Real-world examples
Use cases for the Throttling pattern
Implementing the Throttling pattern
The Retry pattern
Real-world examples
Use cases for the Retry pattern
Implementing the Retry pattern
The Circuit Breaker pattern
Real-world examples
Use cases for the Circuit Breaker pattern
Implementing the Circuit Breaker pattern
Other distributed systems patterns
Summary
10
Patterns for Testing
Technical requirements
The Mock Object pattern
Real-world examples
Use cases for the Mock Object pattern
Implementing the Mock Object pattern
The Dependency Injection pattern
Real-world examples
Use cases for the Dependency Injection pattern
Implementing the Dependency Injection pattern – using a mock object
Implementing the Dependency Injection pattern – using a decorator
Summary
11
Python Anti-Patterns
Technical requirements
Code style violations
Tools for fixing coding style violations
Indentation
Maximum line length and blank lines
Imports
Naming conventions
Comments
Whitespace in expressions and statements
Correctness anti-patterns
Using the type() function for comparing types
Mutable default argument
Accessing a protected member from outside a class
Maintainability anti-patterns
Using a wildcard import
LBYL versus EAFP
Overusing inheritance and tight coupling
Using global variables for sharing data between functions
Performance anti-patterns
Not using .join() to concatenate strings in a loop
Using global variables for caching
Summary
Index
Why subscribe?
Other Books You May Enjoy
Packt is searching for authors like you
Share your thoughts
Download a free PDF copy of this book