PHP Objects, Patterns and Practice (3rd edition)

(Barry) #1
■ INDEX

late static bindings, 49
leaving an overzealous class unchanged,
109
magic methods, 62
making code amenable to variation at
runtime, 146
minimizing top-down control and
dependencies, 100
Minion class, 146
NastyBoss class, 146–147
orthogonality, definition of, 104
overloading, 58
parallel conditionals, 149, 454
PDO class, code listing, 43
performing a task in deliberate ignorance of
its wider context, 25
phpDocumentor, 459
polymorphism, 106, 110, 454
programming-related web sites, list of, 464
read(), 102
reading from and writing to configuration
files, code example, 102
recruit(), 148
reference articles and books, list of, 463
registerCallback(), 67–68
responsibility and the controlling code, 103
reusability, promoting, 455
sale(), 67
simplexml_load_file(), 52
Singleton pattern, 149
SpreadSheet class, 50
static elements, characteristics of, 43
static factory method, 49
static methods, definition of, 42
test frameworks, benefits of, 459
$this pseudo-variable, 42
tight coupling, causes of, 454
__toString(), 65
well-designed objects as self-enclosed, 454
write(), 102
See also design patterns
object-relational impedance mismatch, 276
objects
casting an object to a string, 16
classes and objects, understanding, 15
definition of, 16
identifiers, 16


initial rise of, in PHP, 11
new operator, 16, 21
pass-by-reference rather than pass-by-value,
12–13
PEAR and object-oriented programming, 13
PHP 3 and, 11
PHP 4 and, 12
PHP 5 and, 13
PHP 5.3 and namespaces, 14
PHP 6 and, 14
properties, setting dynamically, 18
taking a design-oriented approach to
projects, 14
__toString(), 16
var_dump(), 16
Zend Engine (ZE3), 12, 14
See also classes
ObjectWatcher class, code listing, 292
Observable interface, code listing, 204
Observer pattern
attach(), 204–206, 209
class diagram, 207
detach(), 204–205, 209
doUpdate(), 206
getStatus(), 206
handleLogin(), 203
implementing, 204
Logger class, 203
Login class, 203–204
LoginObserver class, 206
notify(), 204–205
Observable interface, code listing, 204
overview of, 202
PEAR and, 332
SplObjectStorage class, code listing, 208
Standard PHP Library (SPL), 208
update(), 205
user access example, code listing, 203
onConsecutiveCalls(), 391
operations, 112
OperatorExpression class, 194
operators
instanceof, 31, 83, 108
new, 16, 21
optional element, 340
orthogonality
definition of, 104
Free download pdf