Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:37378 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 13828 invoked from network); 30 Apr 2008 18:06:52 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 30 Apr 2008 18:06:52 -0000 Authentication-Results: pb1.pair.com header.from=jeremy@omegavortex.net; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=jeremy@omegavortex.net; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain omegavortex.net from 207.210.105.196 cause and error) X-PHP-List-Original-Sender: jeremy@omegavortex.net X-Host-Fingerprint: 207.210.105.196 unknown Linux 2.5 (sometimes 2.4) (4) Received: from [207.210.105.196] ([207.210.105.196:34908] helo=vps.omegavortex.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 92/00-13507-B35B8184 for ; Wed, 30 Apr 2008 14:06:51 -0400 Received: from host196-37.dissent.birch.net ([69.53.196.37] helo=[192.168.2.4]) by vps.omegavortex.net with esmtpa (Exim 4.68) (envelope-from ) id 1JrGhZ-00039r-KT; Wed, 30 Apr 2008 14:06:45 -0400 Message-ID: <4818B531.7040505@omegavortex.net> Date: Wed, 30 Apr 2008 13:06:41 -0500 Organization: Omega Vortex Corporation User-Agent: Thunderbird 2.0.0.12 (Windows/20080213) MIME-Version: 1.0 To: Nathan Nobbe CC: internals@lists.php.net References: <7dd2dc0b0804300921y4d87fa25k3530cb864367aa24@mail.gmail.com> In-Reply-To: <7dd2dc0b0804300921y4d87fa25k3530cb864367aa24@mail.gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - vps.omegavortex.net X-AntiAbuse: Original Domain - lists.php.net X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - omegavortex.net X-Source: X-Source-Args: X-Source-Dir: Subject: Re: [PHP-DEV] why interfaces ? From: jeremy@omegavortex.net (Jeremy Privett) Nathan Nobbe wrote: > all, > > in recent weeks there has been a lot of arguing about what interfaces are, > arent (on php-general and now on the internals list as well) etc. etc. > > i am quite curious, why interfaces were added to the language in the first > place. note, i am not criticizing them, i am overjoyed that the language > has them, however i am curious about the history. is this something php > borrowed from java? does it have anything to do with 'entirely virtual > classes' in c++ ? i think that the history behind the addition of > interfaces to php, would shed a lot of light on their intended purpose for > use by php developers. > > thanks, > > -nathan > > "Interfaces" exist in different OO-enabled languages. PHP strengthened its object model in PHP 5, and thus the introduction of interfaces. I'm pretty sure the intended purpose of interfaces was just like pretty much every other language. You implement interfaces in order to provide a consistent API. As long as class A implements interface B, I can be for certain that it's going to contain methods C and D. Interfaces also give you the ability to "type hint" against them, requiring objects that implement that interface, thus ensuring you know what methods are on that object. Interfaces are a very powerful feature, when implemented properly. -- Jeremy Privett C.E.O. & C.S.A. Omega Vortex Corporation http://www.omegavortex.net Please note: This message has been sent with information that could be confidential and meant only for the intended recipient. If you are not the intended recipient, please delete all copies and inform us of the error as soon as possible. Thank you for your cooperation.