Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:49756 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 33875 invoked from network); 17 Sep 2010 17:06:18 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 17 Sep 2010 17:06:18 -0000 Authentication-Results: pb1.pair.com header.from=guilhermeblanco@gmail.com; sender-id=pass; domainkeys=bad Authentication-Results: pb1.pair.com smtp.mail=guilhermeblanco@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.54 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: guilhermeblanco@gmail.com X-Host-Fingerprint: 74.125.82.54 mail-ww0-f54.google.com Received: from [74.125.82.54] ([74.125.82.54:60556] helo=mail-ww0-f54.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id A7/50-30333-700A39C4 for ; Fri, 17 Sep 2010 13:06:16 -0400 Received: by wwb22 with SMTP id 22so2611835wwb.11 for ; Fri, 17 Sep 2010 10:06:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=9wupxtKZHhzklRR/fTf3G/cijIE3MHSC7iqCb/VAMho=; b=wmy5UBGAntrQP1KfwEoObcb5zarde4cdCfQRdCIlonjZFzTMH1hGpJic6dAH+aPQT5 +Mo6JetPcXkdmXr8XT9DEXR1HRKDBd6sNgVniNt0IK3GrW9clyBF1IFY+OHtOechNssK /jgakfnMHC93WCOPrzIU19/UrshlVe6U3Zf0M= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=ObWA+gDjGhDknoZWVYZzUrKENQERBKYKbIcXWkPmVmx6MIpsFBB+QYg/WY+pyzZ5eJ 6ZM7v6x5AICvAUYCkdAppFCeCrArnR/IUaHMzoxCQa4cpljNnfaDLieUY9n+46xcWu28 cYMMGAP+o1CKjaqEBa8wtwWxnWfxGl89zb2go= MIME-Version: 1.0 Received: by 10.216.23.78 with SMTP id u56mr1031507weu.56.1284743172999; Fri, 17 Sep 2010 10:06:12 -0700 (PDT) Received: by 10.216.55.130 with HTTP; Fri, 17 Sep 2010 10:06:12 -0700 (PDT) In-Reply-To: References: <12df042bd98b449afa15c788b9083e51@localhost> Date: Fri, 17 Sep 2010 14:06:12 -0300 Message-ID: To: RQuadling@googlemail.com Cc: Rafael Dohms , Christian Kaps , PHP internals Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] On how a little knowledge is completely useless. From: guilhermeblanco@gmail.com (Guilherme Blanco) Hi Richard, Comments inline On Fri, Sep 17, 2010 at 11:16 AM, Richard Quadling wr= ote: > On 17 September 2010 14:17, Rafael Dohms wrot= e: >> On Fri, Sep 17, 2010 at 6:28 AM, Christian Kaps >> wrote: >>> On Fri, 17 Sep 2010 10:02:10 +0100, Richard Quadling >>> wrote: >>>> One thing that did come to mind is if we ignore all the issues and >>>> complexities of actually implementing annotations, are annotations >>>> useful to a significant number of userland developers. On the surface, >>>> (and this is probably where I'm going wrong), it would seem to only >>>> really be of use to framework developers, and whilst there are at >>>> least 2.5 frameworks per developer, the vast majority of userland >>>> developers are not framework developers. >>> >>> This isn't right. At a first glance, yes it looks that only framework >>> developers can have a benefit from annotations in the core. But the >>> annotations extending the API of a framework so that all developers >>> which using this frameworks have a great benefit of them. >>> >>> Lets take as dependency injection as example. If the framework >>> implements this concept than the user of the framework make the usage o= f >>> this. Or the bean validation framework. This is only for the framework >>> users. >>> >> >> I agree with Christian here, something that is "for framework >> developers" benefits all of the userland users that use that >> framework. >> So we are not looking at the minority of framework developers but at >> the majority of framework users. >> >> So i think the point of "is there use for annotations" is mute, yes >> there is and we don;t see more examples cause we never had it. >> How often did anyone suggest creating a state machine in the ZF >> Controller before we had goto available? once it became available we >> started finding uses for it. >> >> So i'm pretty sure one Annotations exist, more and more people will >> get familiar with it and find new ways to use it in their mindset. > > Thanks for that. > > So, where can I read something about annotations aimed at what must be > painfully obvious someone without all the skills. Unfortunately, my primary source of knowledge contains dummy information, which is Wikipedia. So, for an average explanation of usage, you can check the Annotations RFC[1] or what is described in Java Annotations[2] (although I'm in favor entirely of it). > > How would I use annotations? What problems that I don't know I have do > they solve for me? In PHP exclusively, I can point you the JSR-303 (Bean Validation) that is implemented in Symfony 2. Here is the source: http://github.com/symfony/symfony/tree/master/src/Symfony/Component/Validat= or/ Usage example: http://docs.symfony-reloaded.org/guides/validator.html Another good example is to map your persistence data into your Entities. Doctrine 2 implements this and I think that way you can compare easily with the PHP code alternative. I'd like to ask you to compate the same Entity mapped through Annotations emulator and using raw PHP code: CmsUser using Annotations: http://github.com/doctrine/doctrine2/blob/master/tests/Doctrine/Tests/Model= s/CMS/CmsUser.php CmsUser using PHP code: http://github.com/doctrine/doctrine2/blob/master/tests/Doctrine/Tests/ORM/M= apping/php/Doctrine.Tests.ORM.Mapping.User.php I can't be more explicit how beneficial it is with Annotations support. > > Richard. > > -- > Richard Quadling > Twitter : EE : Zend > @RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > --=20 Guilherme Blanco Mobile: +55 (16) 9215-8480 MSN: guilhermeblanco@hotmail.com S=C3=A3o Paulo - SP/Brazil