Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:37379 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 15503 invoked from network); 30 Apr 2008 18:12:38 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 30 Apr 2008 18:12:38 -0000 Authentication-Results: pb1.pair.com smtp.mail=quickshiftin@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=quickshiftin@gmail.com; sender-id=pass; domainkeys=bad Received-SPF: pass (pb1.pair.com: domain gmail.com designates 72.14.220.152 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: quickshiftin@gmail.com X-Host-Fingerprint: 72.14.220.152 fg-out-1718.google.com Received: from [72.14.220.152] ([72.14.220.152:57897] helo=fg-out-1718.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 50/50-13507-596B8184 for ; Wed, 30 Apr 2008 14:12:38 -0400 Received: by fg-out-1718.google.com with SMTP id 16so236492fgg.23 for ; Wed, 30 Apr 2008 11:12:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:references; bh=10e/DtSi+tanowJg7rZwZH4ntt7fBzy6WRdUoYtjxLs=; b=qUy7rZ6io68Zo1pEzp3EH4outB+89i72tgxbA4PoQLXlo0V99/OyE8d7SkhADSml5XH6LabMFgZZ+WBb7Zr+F+DWtXKETN/8nlTzKuAYXf1q940yd9eS8RbcDSita+1CzJhaYmCiYgaD+/eWdXuBUnpWlTDJ2ayNqmhOFON+ago= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:references; b=lvAN+vNgqUbdOhBrXsbLKcyTKzwrsp1kBFZLodJG0akVQ/pVCkICE8ZXjuks2che+cVzL5gk5/KIww+kstPEDpNKjw+oqYio85JRTno8uqx74DHZpBl0omXBrdYMTc+VBo9643L2ragVNEDOk5bD/FbpAlJ2h8f1Tj/YHMQnibM= Received: by 10.86.50.8 with SMTP id x8mr1370140fgx.29.1209579154833; Wed, 30 Apr 2008 11:12:34 -0700 (PDT) Received: by 10.86.59.15 with HTTP; Wed, 30 Apr 2008 11:12:34 -0700 (PDT) Message-ID: <7dd2dc0b0804301112j72dec359j3b2c042cfa4a6dda@mail.gmail.com> Date: Wed, 30 Apr 2008 12:12:34 -0600 To: "Jeremy Privett" Cc: internals@lists.php.net In-Reply-To: <4818B531.7040505@omegavortex.net> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_186_4769081.1209579154835" References: <7dd2dc0b0804300921y4d87fa25k3530cb864367aa24@mail.gmail.com> <4818B531.7040505@omegavortex.net> Subject: Re: [PHP-DEV] why interfaces ? From: quickshiftin@gmail.com ("Nathan Nobbe") ------=_Part_186_4769081.1209579154835 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline On Wed, Apr 30, 2008 at 12:06 PM, Jeremy Privett wrote: > 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. thank you for you response Jeremy. i understand what interfaces are and i have stressed their importance and power on php-general more than once. im just curious more about what influenced the addition of them to php. im not as old as many of them members in the community, so i know there are many people who have dealt with more languages than i on a daily basis during their careers. from my limited base of knowledge, i think java was the first language to add the keyword 'interface'. and my presumption is that that grew from the convention of creating 'interfaces' in c++ by writing entirely virtual classes (as mentioned in gang of four). i have heard different perspectives on this, but i figured, what better place to get to the bottom of it than to ask the people who decided to add the interface construct to php in the first place. -nathan ------=_Part_186_4769081.1209579154835--