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. =)


Cheers,

On Tue, May 10, 2011 at 7:03 PM, Lars Schultz <lars.schu...@toolpark.com> wrote:
> Am 10.05.2011 17:07, schrieb guilhermebla...@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
>
>



-- 
Guilherme Blanco
Mobile: +55 (16) 9215-8480
MSN: guilhermebla...@hotmail.com
São Paulo - SP/Brazil

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to