Thanks Richard, actually your comments really help. As I said to a few others who replied directly, I feel like it is something I ought to be doing. But most of my development is small-scale and I work alone. There is no "external" pressure to do so. Furthermore, I fear that if I were to use OO methods that someone who might no be so skilled would come in behind me and make a mess.
Hey, it feels good to feel stupid...today is a good day <grin>. Paul Richard Lynch wrote: >>I want to point something out to aspiring authors. The truth is, that few >>books and web pages out there show examples using OO methods. For >>example, the book I use as my primary reference has one chapter on OO PHP >>and that >>is it. The rest of the examples in the book are in regular functions. >>And the one example they give is used to create a web page, with the Title >>, KeyWords, Styles, Header, Menu... as the objects. >> >>So, I guess my point is that if people want to encourage use of OO >>programming, they need to use more examples in their books instead of what >>is "easy." Otherwise, if the reader doesn't "get" the one example, they >>don't have other examples to try. Furthermore, one cannot encourage >>people to think about how they can program using OO methods if they don't >>use such methods in their teaching of the subject matter. > > Basically, a "Simple OO Example" is an oxymoron, or a Bad Example > (apologies to Ralph Covert). > > OO really only shows its strength when you have a certain set of > pre-conditions: > > 1. Multiple programmers working on large-scale project -- OO safely > sub-divides functionality so that they can code with less risk of screwing > each other up. > > 2. "Library" release code (eg PHPLib) -- OO allows you to have minimal > impact on the main application's variables/constants etc by providing a > separate name-space > > 3. "Real-World Object" being modeled in complex/interesting ways -- OO > provides a more "natural" coding style for this in some cases. > > None of these pre-conditions is met in a "Simple Example" > > That said, there are a zillion PHP OO applications/solutions "out there" > for > you to look at. Some even have comments. A few even have *GOOD* > comments. > :-) > > It is entirely possible, however, that you don't even *NEED* OO for > anything > you're doing. If your project doesn't meet any of the above three > pre-conditions, chances are Really Good that OO would be like swatting a > fly > with a cannon. You can do it. And if a cannon is all you know how to > work > properly, maybe that's the best answer. But it's usually not the "best" > answer in a general sense. > > NOTE: > I'm an old-school Lisp hacker. I *LOVE* Object-Oriented systems. Yet I > rarely feel a need for OO in my PHP scripts. YMMV. > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php