Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:37325 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 95391 invoked from network); 30 Apr 2008 05:07:30 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 30 Apr 2008 05:07:30 -0000 Authentication-Results: pb1.pair.com header.from=robert@interjinn.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=robert@interjinn.com; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain interjinn.com from 66.11.173.122 cause and error) X-PHP-List-Original-Sender: robert@interjinn.com X-Host-Fingerprint: 66.11.173.122 unknown Received: from [66.11.173.122] ([66.11.173.122:56163] helo=interjinn.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id E3/69-28930-19EF7184 for ; Wed, 30 Apr 2008 01:07:29 -0400 Received: from [192.168.1.3] (blobule.suds [192.168.1.3]) by interjinn.com (Postfix) with ESMTP id 1E69D11FB6D; Wed, 30 Apr 2008 01:07:25 -0400 (EDT) To: Nathan Nobbe Cc: RQuadling@googlemail.com, "John Carter -X (johncart - PolicyApp Ltd at Cisco)" , internals@lists.php.net In-Reply-To: <7dd2dc0b0804292127p484d8c7g9cf852f0a79a8dc6@mail.gmail.com> References: <48169695.9040803@omegavortex.net> <27A086AB-E111-49C1-ABBD-28FB6E1677BD@procata.com> <48175A65.4070301@zend.com> <1209512914.7057.296.camel@blobule> <10845a340804291714g7eb10362m17af4abecbadf0e4@mail.gmail.com> <7dd2dc0b0804291801m627a7c31h8dd796d7fa1d1257@mail.gmail.com> <1209518549.7057.313.camel@blobule> <7dd2dc0b0804292051o4fd5e77eu6f8faecad93c378a@mail.gmail.com> <1209528338.7057.349.camel@blobule> <7dd2dc0b0804292127p484d8c7g9cf852f0a79a8dc6@mail.gmail.com> Content-Type: text/plain Organization: InterJinn Date: Wed, 30 Apr 2008 01:07:26 -0400 Message-ID: <1209532046.7057.368.camel@blobule> Mime-Version: 1.0 X-Mailer: Evolution 2.12.1 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Class Properties in Interfaces? From: robert@interjinn.com (Robert Cummings) On Wed, 2008-04-30 at 00:27 -0400, Nathan Nobbe wrote: > On Wed, Apr 30, 2008 at 12:05 AM, Robert Cummings > > Abstract classes and interfaces are not the same. They are > used for > fundamentally different reasons. An interface is to enforce a > contract > for all implementations of the interface. Therefore if I were > to create > an interface with an interface property of x, then all > implementations > using that interface would know that property x exists and > could use it > thusly without having to check for it's existence. > > i am fully aware of the differences between interfaces and abstract > classes. however, if a public method is defined on any class, > abstract or concrete, it may be used without checking by client code; > i believe thats the entire point.. > > Using an abstractclass is a hack, it's not sufficient for > enforcement, and you can't > combine multiple abstract classes as you can with interfaces. > > abstract classes have their place. primarily they are well suited for > template method because some methods can be forced to be implemented > by children and others can be optionally overridden. > > and lastly, coming to multiple inheritance (for lack of better > terminology); that is the only argument with any value for adding > public attributes to the interface construct; however i am still not > receptive to it. from my perspective data is an implementation > detail, period. We are not talking about data here. We are talking about properties. Data is assigned to a property which is akin to functionality being assigned to a method. A property has all the features of the most simple getter/setter method combination in one fell statement and without the envelope overhead. As such, there is no reason why it could not be part of the interface design. Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP