With the surge of popularity of PHP 5, object-oriented programming is now an important consideration for PHP developers. This version-neutral book is a gentle introduction to object-oriented programming (OOP) that won't overburden you with complex theory. It teaches you the essential basics of OOP that you'll need to know before moving onto a more advanced level, and includes a series of prepackaged scripts that you can incorporate into your existing sites with the minimum of effort.
It shows how object-oriented programming can be used to create reusable and portable code by walking you through a series of simple projects. The projects feature the sorts of things developers run up against every day, and include a validator for filtering user input, a simple Date class that avoids the need to remember all the esoteric format codes in PHP, and an XML generator.
- Teaches the fundamentals of OOP
- Simple projects show how OOP concepts work in the real world
- Prepackaged scripts can easily be added to your own projects
My first experiments with object-oriented programming in PHP took place about six years ago. Unfortunately, the book that introduced me to the subject concentrated on the mechanics of writing classes and paid little heed to principles underlying OOP. As a result, I wrote classes that were closely intertwined with a specific project (tightly coupled, to use the OOP terminology). Everything worked exactly the way I wanted, but the design had a fundamental flaw: the classes couldnt be used for any other project. Worse still, it was a large projecta bilingual, searchable database with more than 15,000 recordsso any changes I wanted to make to it involved revising the whole code base. The purpose of this book is to help you avoid the same mistake. Although most chapters revolve around mini-projects, the classes they use are project-neutral. RlC%