Chapter 4. SHOW A LITTLE CLASS

Introductory books on object-oriented programming (OOP) often use examples of objects taken from the real world. For example, you may be asked to imagine a "dog" class. We are all familiar with dogs, of course, so it's relatively easy to describe a dog's attributes. Most dogs have hair, four legs, and a tail. A dog's behavior is equally easy to describe. Dogs bark, jump, run, roll over, dig, and, when passing fire hydrants . . .

I don't mean to belittle this approach, but the objects that a web developer deals with are not often objects "out there" that one can point to. They are more likely to be conceptual rather than physical objects, and these are a little harder to identify. Once identified, it is not easy ...

Get Object-Oriented PHP now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.