Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:52217 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 64700 invoked from network); 10 May 2011 14:12:52 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 10 May 2011 14:12:52 -0000 Authentication-Results: pb1.pair.com smtp.mail=lars.schultz@toolpark.com; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=lars.schultz@toolpark.com; sender-id=unknown Received-SPF: error (pb1.pair.com: domain toolpark.com from 195.49.42.12 cause and error) X-PHP-List-Original-Sender: lars.schultz@toolpark.com X-Host-Fingerprint: 195.49.42.12 mail1.screenlight.ch Received: from [195.49.42.12] ([195.49.42.12:56346] helo=mail1.screenlight.ch) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 3F/D2-43407-2E749CD4 for ; Tue, 10 May 2011 10:12:52 -0400 Received: from [192.168.1.112] ([192.168.1.112]) (authenticated user lars.schultz@toolpark.com) by mail1.screenlight.ch (Kerio Connect 7.0.2 patch 1) (using TLSv1/SSLv3 with cipher AES256-SHA (256 bits)) for internals@lists.php.net; Tue, 10 May 2011 16:12:47 +0200 Message-ID: <4DC947E3.8070606@toolpark.com> Date: Tue, 10 May 2011 16:12:51 +0200 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; de; rv:1.9.2.9) Gecko/20100915 Lightning/1.0b2 Thunderbird/3.1.4 MIME-Version: 1.0 To: internals@lists.php.net References: <4DC826B1.4090806@lerdorf.com> <4DC82A36.8090604@lerdorf.com> <4DC83401.2090202@sugarcrm.com> <4DC8D122.3050507@lsces.co.uk> <4DC8F125.2010503@toolpark.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] annotations again From: lars.schultz@toolpark.com (Lars Schultz) Am 10.05.2011 14:47, schrieb Martin Scotta: > Annotated code integrates best with library/frameworks without the need to > "extends" or "implements". > Without annotation you will need to extend some class or to implement some > interface. That means more code to write, more chances to shoot you foot. Umm. Is there any way with the Annotation-proposal to validate a class to have all the necessary annotations to work with a certain framework? Is there an annotation-Schema or DTD which I can apply against my classes and validate them? Because that's what you get when using interfaces. Which means less "shooting in the foot". As for writing less code...If there is any shared code, we now have traits!;) hurray! > With annotation your classes are unaware of the other components, which > implies: > * shorter, concise code => less bugs > * no extra dependencies => easy to test > > class UserFoo extends LibraryFoo { } I can see that extending does not really work when using frameworks. But when using interfaces and traits in conjunction, this is not necessary anymore. > class UserBar implements LibraryBar { > // even worst you will need to write some methods here > } I don't get what the problem with writing methods is. They are readable by any PHP5 developer and you get all kind of support in writing them. > With annotations classes are "free" to live on you own herarchy The same holds true for interfaces.