Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:52262 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 91394 invoked from network); 10 May 2011 22:28:30 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 10 May 2011 22:28:30 -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 209.85.160.170 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: 209.85.160.170 mail-gy0-f170.google.com Received: from [209.85.160.170] ([209.85.160.170:41696] helo=mail-gy0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id FA/26-04851-C0CB9CD4 for ; Tue, 10 May 2011 18:28:29 -0400 Received: by gyb11 with SMTP id 11so2831189gyb.29 for ; Tue, 10 May 2011 15:28:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-type:content-transfer-encoding; bh=H26Ilfz5IlQokQFYBktuBPodoNCEJgRNXBNs0+YqPHo=; b=tf1Tefu6kto4ZiA4bnXwxrbbkqAD2bCHYA+cUcc2ebZ+/vSaWolSm5pE9mb7/ViuDY fBZt/pKYcqSHwAoXaop0u+3VhftQ2lBPDY4rFnVNlv+GIHW6hHCzFIOyT5DWsl1UNaeT TuEhSAF1XbTd1Doei5w8colDD0MNNtLugJkw8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; b=cb3mZUBjl0npOtgyY2MuPDE1SvTQ5r8oSSzx1onG6Zn31mu4Qd4j7wsaBBhJr84+/d bk77fCIv/wJccKNFmwD02nggTwm2pYbnuL2tHFbb6l5UcKgPHSdrRf5DDT8/A9YyBhwX 7V1qG2OMzzJXbawoEVRczjSSlfFQvM9UQO6LQ= Received: by 10.236.185.163 with SMTP id u23mr10001897yhm.177.1305066506150; Tue, 10 May 2011 15:28:26 -0700 (PDT) MIME-Version: 1.0 Received: by 10.147.171.4 with HTTP; Tue, 10 May 2011 15:28:06 -0700 (PDT) In-Reply-To: <4DC9B62C.2040009@toolpark.com> References: <4DC826B1.4090806@lerdorf.com> <4DC82A36.8090604@lerdorf.com> <4DC83401.2090202@sugarcrm.com> <4DC8D122.3050507@lsces.co.uk> <4DC8F125.2010503@toolpark.com> <4DC947E3.8070606@toolpark.com> <4DC9B62C.2040009@toolpark.com> Date: Tue, 10 May 2011 19:28:06 -0300 Message-ID: To: Lars Schultz Cc: internals@lists.php.net Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] annotations again From: guilhermeblanco@gmail.com ("guilhermeblanco@gmail.com") Not trying to be harsh, but I'm not bloating my PHP example. That's the actual way Doctrine supports Metadata information. I can explain= why. Conceptually, an architectural design of an entity should not know anything about its persistence information. By that means, we cannot for example implement an interface (which seems you have forgotten to add) or an abstract class for "getAnnotations()" method. If you enforce people to implement an abstract class or even an interface, you bring 2 problems: - Entities with knowledge about its persistence information - Resources being wasted - You rely on an instance to grab information. Or you use a slow approach of having a static method The second argument is valid because in a request you're able to deal with an average number of methods. Each method is a pointer of 4 bytes. By having an "irrelevant" method on entity, you consume (on a page with 500 entities), 2000 bytes of unnecessary resources. The third argument is exactly what we had on Doctrine 1. We relied on a ghost entity for metadata retrieval. This brings a whole new level of issues to deal with. Making it static, slow down a lot the overall ClassMetadata retrieval information. Also, there are much more things than you can actually think of related to = this. The code is not bloated. Since you don't have a "pre-processor" for class metadatas, you have to build all definitions manually. This is why you have to set inheritance type, for example. $metadata->setInheritanceType(ClassMetadataInfo::INHERITANCE_TYPE_NONE); FYI, Doctrine took an year of planning an another year of careful implementation of each feature. This means to you that every single feature was carefully planned, optimized and implemented with performance, good OO design and extensibility. =3D) Cheers, On Tue, May 10, 2011 at 7:03 PM, Lars Schultz w= rote: > Am 10.05.2011 17:07, schrieb guilhermeblanco@gmail.com: >> >> Is that still simple? > > You bloated the php example unnecessarily. This contains the same > information as your Annotations example, which to me, is very similar. > > http://pastie.org/1886774 > > > -- > 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