Author(s): Junade Ali
Publisher: Packt
Year: 2016
Language: English
Pages: 267
Tags: PHP
Cover
......Page 1
Copyright......Page 3
Credits......Page 4
About the Author......Page 5
About the Reviewer......Page 6
www.PacktPub.com......Page 7
Table of Contents......Page 8
Preface......Page 12
Chapter 1: Why "Good PHP Developer" Isnt an Oxymoron......Page 19
Polymorphism......Page 22
Traits (multiple inheritance)......Page 27
Scalar type hints......Page 30
Limiting debug access to private/protected properties......Page 32
Setting up the environment with Composer......Page 34
The Gang of Four (GoF)......Page 37
Dependency injection......Page 38
Architectural patterns......Page 39
Summary......Page 40
Chapter 2: Anti-Patterns......Page 41
Why anti-patterns matter......Page 42
Not invented here syndrome......Page 45
Third-party dependencies with Composer......Page 47
God objects......Page 51
Environment variables in PHP source......Page 54
Singletons (and why you should be using dependency injection)......Page 55
Database as IPC......Page 56
Auto-increment database IDs......Page 57
Software in place of architecture......Page 58
Interface Bloat......Page 60
Cart before the horse......Page 62
Excessive separation of development responsibilities......Page 63
Error suppression operator......Page 64
Blind faith......Page 65
Sequential coupling......Page 66
The big rewrite......Page 69
Automated tests......Page 70
Service splitting......Page 71
Perfectly staged migrations......Page 72
Bloated optimization......Page 73
Premature optimization......Page 74
Wrong rocky foundations......Page 75
Long methods......Page 76
Summary......Page 81
Software design process......Page 83
Simple Factory......Page 85
Factory Method......Page 89
Abstract Factory pattern......Page 93
Lazy initialization......Page 101
Builder pattern......Page 104
Prototype pattern......Page 108
Summary......Page 113
Chapter 4: Structural Design Patterns......Page 114
Agile software architecture......Page 115
Decorator......Page 116
Class Adapter......Page 119
Object Adapter......Page 121
FlyWeight......Page 124
Composite......Page 128
Bridge......Page 131
Proxy pattern......Page 134
Facade......Page 138
Summary......Page 141
Chapter 5: Behavioral Design Patterns......Page 143
Personality traits for passionate programmers......Page 144
Observer pattern (SplObserver/SplSubject)......Page 146
IteratorAggregate......Page 150
Iterator......Page 152
The many iterators of PHP......Page 153
Generators......Page 154
Template Method design pattern......Page 159
Chain of Responsibility......Page 163
Strategy design pattern......Page 170
Specification design pattern......Page 174
Scheduled Task pattern......Page 178
Summary......Page 179
Model-View-Controller (MVC)......Page 181
Service-oriented architecture......Page 183
Microservices......Page 184
Message Queue pattern (Getting started with RabbitMQ)......Page 188
Publish-Subscriber pattern......Page 198
Summary......Page 202
What is refactoring?......Page 203
Test, test, and test again......Page 204
Code smells......Page 205
Long methods and duplicated code......Page 206
Large class......Page 208
Replacing complex logical statements and switch statements with polymorphism or the Strategy Pattern......Page 209
Long Parameter List and primitive obsession......Page 211
Indecent exposure......Page 214
Feature envy......Page 215
Deeply nested statements......Page 217
Remove assignments to parameters......Page 218
Encapsulating Composite with Builder......Page 219
Replacing one/many distinctions with Composite......Page 220
What do I tell my manager?......Page 221
Summary......Page 222
Nature of a HTTP request......Page 223
Versioning......Page 242
Searching......Page 243
When in doubt – KISS......Page 244
Software development life cycle......Page 245
On Scrum, and real Agility......Page 246
You need to sack people sometimes......Page 248
YAGNI and defering decisions......Page 250
Monitoring......Page 251
Tests fight legacy......Page 252
Behavior-Driven Development......Page 254
Summary......Page 261
Index......Page 263