Re: Beginner Tutorials for using CLASSES in PHP4

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

 



On Wed, 2007-10-10 at 20:45 -0400, Nathan Nobbe wrote:
> On 10/10/07, Robert Cummings <robert@xxxxxxxxxxxxx> wrote:
> >
> > What I was really illustrating is how interfaces are syntactic
> > sugar only. In my above example what I've really shown is an
> > implicit interface :) Since OOP is largely meant to model real
> > world things, ask yourself this... when a doctor sews a pig's
> > heart into a human, do you think there's an explicit interface
> > someplace that checks for compatibility, or does it "just work"
> > if the conditions are right. Food for thought, pork in fact ;)
> 
> 
> i would look at that as a great example of an interface in action.
> the pigs heart has to be compatible with the human body in some
> way; they both have the same interface; namely the holes the tubes
> connect to.  i assume the doctors are the ones who run the interface
> compatibility check.
> the implementation is different i suppose (im not a biologist, just
> guessing here :))  but thats the beauty of an interface; you just get
> a contract, not behavior.

That's right... it's an implicit interface, not an explicit interface,
the doctor doesn't run to some God/Evolution/Simulation mandated
interface to check his implementation. He just wires things up, does
some tweaking, hopes for the best. He doesn't get any feedback like
"Sorry, pig's heart must implement HumanBlood interface." If it isn't
compatible the human dies-- that's a perfect example of an implicit
interface, the body will just do what it usually does regardless of
whether you hook up a pig's heart or a kitchen sink. Compatibility will
be decided at run-time :)

Cheers,
Rob.
-- 
...........................................................
SwarmBuy.com - http://www.swarmbuy.com

    Leveraging the buying power of the masses!
...........................................................

-- 
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