On Fri, 2006-09-29 at 11:07 -0500, Richard Lynch wrote: > On Fri, September 29, 2006 4:35 am, benifactor wrote: > > ..and this seems to work fine, i could easily add the mail function > > and insert real variables into send() but what i don't understand is i > > could also easily do this without a class... so i guess the real > > question is what are some real life examples of class usage and why is > > it used as opposed to regular non oop? thank you for any input into > > the subject that you may have. > > For something that small, using a class is ridiculous, bloated, > over-engineered pointless exercise. > > Rather than type "ridiculous, bloated, over-engineered pointless > exercise" in this email again, I'll simply dub that "Wrong Answer" and > type that a lot. > > In fact, for almost *ANY* small/simple problem OOP is the "Wrong Answer". > > OOP shines, however, in some large-scale usage: > > #1. One architect, many developers > If you have ONE project architect cleanly map out a Plan in the form > of a large class structure, with a clear and clean internal API, and a > bunch of junior programmers to fill in the details, the Architect can > use OOP with stub functions, just like you wrote above, to build the > framework, and the junior programmers can fill in all the stubs. > > #2 Real-world parallels > Sometimes when modeling real-world parallels (or even Virtual World > parallels like game prototyping, windowing systems, etc) having OOP > leads to a very natural readable maintainable code-base, as the > operations and variables and the interaction between them mirrors to a > large extent the operation and interaction between their real-world > counterparts. #3 In PHP PHP has no namespaces, use classes to improve your chances of avoiding namespace collisions. And I realize Richard will call this the wrong answer, but when you don't have the tools you need, you make use of the ones you do have. Cheers, Rob. -- .------------------------------------------------------------. | InterJinn Application Framework - http://www.interjinn.com | :------------------------------------------------------------: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `------------------------------------------------------------' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php