PHP Objects, Patterns, and Practice (eBook)
487 Seiten
Apress (Verlag)
978-1-4302-0467-1 (ISBN)
At last - a second edition of this classic web development work. PHP Objects, Patterns, and Practice shows you how to meld the power of PHP with the sound enterprise development techniques embraced by professional programmers. Going well beyond the basics of object-oriented development, you'll learn about advanced topics such as working with static methods and properties, abstract classes, interfaces, design patterns, exception handling, and more. You'll also be exposed to key tools such as PEAR, CVS, Phing, and phpDocumentor. PHP is the most popular web development language in the world. With corporate adoption on the rise, this fully updated and enhanced edition is an essential text for webmasters.
Matt Zandstra has worked as a web programmer, consultant, and writer for nearly two decades. He is the author of SAMS Teach Yourself PHP in 24 Hours (three editions) and a contributor to DHTML Unleashed. He has written articles for Linux Magazine, Zend.com, IBM DeveloperWorks, and php|architect Magazine, among others. Matt works as a consultant advising companies on their architectures and system management, and also develops systems primarily with PHP, and Java. Matt also writes fiction.
Backed by a tireless development community, PHP has been a model of language evolution over its 10+ year history. Borne from a contract developer's pet project, these days you'll find PHP powering many of the world's largest web sites, including Yahoo!, Digg, EA Games, and Lycos.PHP Objects, Patterns, and Practice, Second Edition shows you how to meld the power of PHP with the sound enterprise development techniques embraced by professional programmers. Going well beyond the basics of object oriented development, you'll learn about advanced topics such as working with static methods and properties, abstract classes, interfaces, design patterns, exception handling, and more. You'll also be exposed to key tools such as PEAR, CVS, Phing, and phpDocumentor.
Matt Zandstra has worked as a web programmer, consultant, and writer for nearly two decades. He is the author of SAMS Teach Yourself PHP in 24 Hours (three editions) and a contributor to DHTML Unleashed. He has written articles for Linux Magazine, Zend.com, IBM DeveloperWorks, and php|architect Magazine, among others. Matt works as a consultant advising companies on their architectures and system management, and also develops systems primarily with PHP, and Java. Matt also writes fiction.
Contents at a Glance 5
Contents 7
About the Author 17
About the Technical Reviewer 18
Acknowledgments 19
Introduction to the First Edition 20
Introduction to the Second Edition 21
Introduction 22
PHP: Design and Management 23
The Problem 23
PHP and Other Languages 24
About This Book 26
Summary 28
Objects 29
PHP and Objects 30
The Accidental Success of PHP Objects 30
Into the Future: PHP 6 33
Advocacy and Agnosticism: The Object Debate 34
Summary 34
Object Basics 35
Classes and Objects 35
Setting Properties in a Class 37
Working with Methods 40
Arguments and Types 43
Inheritance 48
Summary 62
Advanced Features 63
Static Methods and Properties 63
Constant Properties 66
Abstract Classes 67
Interfaces 69
Handling Errors 71
Final Classes and Methods 77
Working with Interceptors 78
Defining Destructor Methods 82
Copying Objects with __ clone() 84
Defining String Values for Your Objects 86
Summary 87
Object Tools 88
PHP and Packages 88
The Class and Object Functions 95
The Reflection API 101
Summary 112
Objects and Design 113
Defining Code Design 113
Object- Oriented and Procedural Programming 114
Choosing Your Classes 119
Polymorphism 120
Encapsulation 122
Forget How to Do It 123
Four Signposts 124
The UML 125
Summary 134
Patterns 135
What Are Design Patterns? Why Use Them? 136
What Are Design Patterns? 136
A Design Pattern Overview 138
The Gang of Four Format 140
Why Use Design Patterns? 140
PHP and Design Patterns 142
Summary 143
Some Pattern Principles 144
The Pattern Revelation 144
Composition and Inheritance 145
Decoupling 150
Code to an Interface, Not to an Implementation 152
The Concept That Varies 153
Patternitis 154
The Patterns 154
Summary 155
Generating Objects 156
Problems and Solutions in Generating Objects 156
The Singleton Pattern 160
Factory Method Pattern 164
Abstract Factory Pattern 169
But That's Cheating! 179
Summary 180
Patterns for Flexible Object Programming 181
Structuring Classes to Allow Flexible Objects 181
The Composite Pattern 182
The Decorator Pattern 191
The Facade Pattern 197
Summary 200
Performing and Representing Tasks 201
The Interpreter Pattern 201
The Strategy Pattern 211
The Observer Pattern 216
The Visitor Pattern 223
The Command Pattern 230
Summary 235
Enterprise Patterns 236
Architecture Overview 236
Cheating Before We Start 240
The Presentation Layer 250
The Business Logic Layer 280
Summary 288
Database Patterns 289
The Data Layer 289
Data Mapper 290
Identity Map 303
Unit of Work 307
Domain Object Factory 314
The Identity Object 317
The Selection Factory and Update Factory Patterns 323
What's Left of Data Mapper Now? 327
Summary 330
Practice 331
Good (and Bad) Practice 332
Beyond Code 332
Borrowing a Wheel 333
Playing Nice 334
Giving Your Code Wings 335
Documentation 336
Testing 337
Summary 338
An Introduction to PEAR 339
What Is PEAR? 340
Installing a Package with PEAR 341
Using a PEAR Package 343
Creating Your Own PEAR Package 348
Summary 362
Generating Documentation with phpDocumentor 363
Why Document? 363
Installation 364
Generating Documentation 365
DocBlock Comments 367
Documenting Classes 368
File- Level Documentation 370
Documenting Properties 370
Documenting Methods 372
Creating Links in Documentation 374
Summary 377
Version Control with CVS 378
Why Use Version Control? 378
Getting CVS 379
Configuring a CVS Repository 380
Beginning a Project 383
Updating and Committing 385
Adding and Removing Files and Directories 389
Tagging and Exporting a Release 392
Branching a Project 394
Summary 398
Testing with PHPUnit 399
Functional Tests and Unit Tests 399
Testing by Hand 400
Introducing PHPUnit 402
A Note of Caution 417
Summary 419
Automated Build with Phing 420
What Is Phing? 420
Getting and Installing Phing 421
Composing the Build Document 422
Summary 439
Conclusion 440
Objects, Patterns, Practice 441
Objects 441
Patterns 444
Practice 446
Summary 449
Appendixes 450
Bibliography 451
Books 451
Articles 452
Sites 452
A Simple Parser 453
The Scanner 453
The Parser 461
Index 475
| Erscheint lt. Verlag | 5.4.2008 |
|---|---|
| Zusatzinfo | 487 p. |
| Verlagsort | Berkeley |
| Sprache | englisch |
| Themenwelt | Mathematik / Informatik ► Informatik ► Programmiersprachen / -werkzeuge |
| Mathematik / Informatik ► Informatik ► Software Entwicklung | |
| Mathematik / Informatik ► Informatik ► Web / Internet | |
| Schlagworte | abstract class • CVS • Design • Design Pattern • Development • documentation • interfaces • language • object • PHP • PhpDocumentor • PHPUnit • programming |
| ISBN-10 | 1-4302-0467-2 / 1430204672 |
| ISBN-13 | 978-1-4302-0467-1 / 9781430204671 |
| Informationen gemäß Produktsicherheitsverordnung (GPSR) | |
| Haben Sie eine Frage zum Produkt? |
DRM: Digitales Wasserzeichen
Dieses eBook enthält ein digitales Wasserzeichen und ist damit für Sie personalisiert. Bei einer missbräuchlichen Weitergabe des eBooks an Dritte ist eine Rückverfolgung an die Quelle möglich.
Dateiformat: PDF (Portable Document Format)
Mit einem festen Seitenlayout eignet sich die PDF besonders für Fachbücher mit Spalten, Tabellen und Abbildungen. Eine PDF kann auf fast allen Geräten angezeigt werden, ist aber für kleine Displays (Smartphone, eReader) nur eingeschränkt geeignet.
Systemvoraussetzungen:
PC/Mac: Mit einem PC oder Mac können Sie dieses eBook lesen. Sie benötigen dafür einen PDF-Viewer - z.B. den Adobe Reader oder Adobe Digital Editions.
eReader: Dieses eBook kann mit (fast) allen eBook-Readern gelesen werden. Mit dem amazon-Kindle ist es aber nicht kompatibel.
Smartphone/Tablet: Egal ob Apple oder Android, dieses eBook können Sie lesen. Sie benötigen dafür einen PDF-Viewer - z.B. die kostenlose Adobe Digital Editions-App.
Buying eBooks from abroad
For tax law reasons we can sell eBooks just within Germany and Switzerland. Regrettably we cannot fulfill eBook-orders from other countries.
aus dem Bereich