Re: class usage

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



My goal was to make you aware that you are on a wide-open path with
many branches, most of which lead you to disaster, but several of
which are VERY GOOD PATHS to using OOP in a sensible and incredibly
beneficial manner.

Unfortunately, to get to the GOOD PATHS you have to hop over a couple
streams and take several bad paths, and then realize how/why they are
bad, and then backtrack and start all over, and then you have to be
very careful, because there is an entirely whole other class of BAD
PATHS at a whole new level of complexity, with only a few GOOD PATHS
at the very very very end...

It's really a whole lot like a very very very long and complicated
adventure with only 3 "winning" outcomes, and a heck of a lot of false
trails that LOOK good until you end up dead, or, worse, wandering
around the maze *thinking* you're making great progress and everything
is fine, when, in reality, you've already broken off from the viable
paths to the winning ends.

You could spend an entire career making decent money in this maze,
mind you, but it doesn't mean your code is any good in my book. :-)

Hope that clarifies rather than confuses.

On Fri, September 29, 2006 5:17 pm, benifactor wrote:
> thank you all for your input, and thank you richard for breaking that
> down
> nice and slow for me :) uhh, that was just me trying to see how a
> class
> works, and is by no means a real program and will never be. just as i
> was
> coding my first class i confused myself thinking that i could do the
> same
> stuff without classes and such...  however i need to make trivial
> useless
> scripts to learn before i come across the need to use real classes and
> objects to avoid ending up lost and begging the list for help. any
> other
> comments would also be appreciated... thanks again.
> ----- Original Message -----
> From: "Richard Lynch" <ceo@xxxxxxxxx>
> To: "benifactor" <snorris17@xxxxxxx>
> Cc: "php" <php-general@xxxxxxxxxxxxx>
> Sent: Friday, September 29, 2006 9:07 AM
> Subject: Re:  class usage
>
>
>> 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.
>>
>> The biggest problem in OOP, in my experience, is that you have many
>> developers, like yourself, who begin using OOP solely because they
>> are
>> told that "it's better"
>>
>> Many of these developers then go on to write *BAD* OOP code, for all
>> the wrong reasons, in all the wrong places, to solve trivial
>> problems
>> with the "Wrong Answer".
>>
>> Many of these developers continue to use the "Wrong Answer" over and
>> over, and never actually utilize any of the strengths of OOP, but
>> instead train themselves to misapply OOP.  Their code "works" it's
>> just oftentimes the "Wrong Answer"
>>
>> Unfortunately, learning to use OOP correctly is a long-term process,
>> and you have to do a bunch of trivial things with the "Wrong Answer"
>> just to figure out how it works -- Which means you really should
>> re-do
>> them as non OOP, or be doing them solely as a means of learning and
>> not throwing them into Production.
>>
>> Alas, this is not how 99% of OOP code in Production ends up in
>> Production...  All too often, it's the "Wrong Answer" that gets
>> thrown
>> into Production.
>>
>> This is not meant as a "dis" of the great OOP code out there.  I've
>> seen some very very very nice OOP systems in the past -- in Lisp, to
>> solve large-scale problems.
>>
>> In PHP, to spit out a web page in under 1.7 seconds, not so much.
>> :-)
>>
>> I'm sure somebody out there has a GREAT PHP web application with a
>> complex backend all in OOP.  So far, all I've seen is "Wrong
>> Answer".
>>
>> YMMV
>>
>> --
>> Like Music?
>> http://l-i-e.com/artists.htm
>>
>>
>
>


-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux