售 价:¥
温馨提示:数字商品不支持退换货,不提供源文件,不支持导出打印
为你推荐
Mastering PHP Design Patterns
Mastering PHP Design Patterns
Credits
About the Author
About the Reviewer
www.PacktPub.com
Why subscribe?
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Errata
Piracy
Questions
1. Why "Good PHP Developer" Isnt an Oxymoron
Coding style - the PSR standards
Revising object-oriented programming
Polymorphism
Traits (multiple inheritance)
Scalar type hints
Limiting debug access to private/protected properties
Setting up the environment with Composer
The Gang of Four (GoF)
Creational design patterns
Dependency injection
Structural design patterns
Behavioral design patterns
Architectural patterns
Summary
2. Anti-Patterns
Why anti-patterns matter
Not invented here syndrome
Third-party dependencies with Composer
God objects
Environment variables in PHP source
Singletons (and why you should be using dependency injection)
Dependency injection
Database as IPC
Auto-increment database IDs
Cronjob imitating service
Software in place of architecture
Interface Bloat
Cart before the horse
Separation of development and operations
Excessive separation of development responsibilities
Error suppression operator
Blind faith
Sequential coupling
The big rewrite
Automated tests
Service splitting
Perfectly staged migrations
Tester-Driven Development
Bloated optimization
Analysis paralysis
Bikeshedding
Premature optimization
Uneducated manager syndrome
Wrong rocky foundations
Long methods
Magic numbers
Summary
3. Creational Design Patterns
Software design process
Simple Factory
Factory Method
Abstract Factory pattern
Lazy initialization
Builder pattern
Prototype pattern
Summary
4. Structural Design Patterns
Agile software architecture
Decorator
Adapter
Class Adapter
Object Adapter
FlyWeight
Composite
Bridge
Proxy pattern
Facade
Summary
5. Behavioral Design Patterns
Personality traits for passionate programmers
Observer pattern (SplObserver/SplSubject)
Iterators
IteratorAggregate
Iterator
The many iterators of PHP
Generators
Template Method design pattern
Chain of Responsibility
Strategy design pattern
Specification design pattern
Scheduled Task pattern
Summary
6. Architectural Patterns
Model-View-Controller (MVC)
Service-oriented architecture
Microservices
Asynchronous queueing
Message Queue pattern (Getting started with RabbitMQ)
Publish-Subscriber pattern
Summary
7. Refactoring
What is refactoring?
Test, test, and test again
Code smells
Long methods and duplicated code
Large class
Replacing complex logical statements and switch statements with polymorphism or the Strategy Pattern
Duplicating code following a single control structure
Long Parameter List and primitive obsession
Indecent exposure
Feature envy
Inappropriate intimacy
Deeply nested statements
Remove assignments to parameters
Comments
Encapsulating Composite with Builder
Replacing hard-coded notifications with Observer
Replacing one/many distinctions with Composite
Separate versions with Adapters
What do I tell my manager?
Summary
8. How to Write Better Code
Nature of a HTTP request
RESTful API design
Stateless nature
Versioning
Filtering
Sorting
Searching
Limiting fields
Returning new fields
When in doubt – KISS
Software development life cycle
On Scrum, and real Agility
You need to sack people sometimes
Lean project management
YAGNI and defering decisions
Monitoring
Tests fight legacy
Behavior-Driven Development
Summary
买过这本书的人还买过
读了这本书的人还在读
同类图书排行榜