Hi,
You all think that mapping something can always be abstracted into a
few lines like the one you presented.
Well, in certain cases your idea is valid. I'd then point you an
Entity mapping of Doctrine 2 with and without Annotations, so you can
imagine how much it can abstract:
With Doctrine Annotations:
http://pastie.org/1885284With my proposal:
http://pastie.org/1885294Without Annotations:
http://pastie.org/1885252Is that still simple?
Regarding usability, I thought that it is not "it must be used by
10,000k people to be relevant".
I think the best thing that can prove that is "goto". I didn't see a
lot of people requesting for it, but it was still included.
Let me ask you then: if it wasn't widely requested (considering your
argument that only massive requests should be relevant), why was it
included?
Regarding BC, IDEs, etc... Traits also includes new keywords and none
complained about "IDE won't support immediately".
Should I consider then that your arguments that you are strongly
forcing to be valid on this subject should also be strong on traits?
If yes, why traits was included?
Regarding readability, traits and annotations follow a similar path.
Everything that annotations can do, with much more work PHP can do
too. The same applies to traits. So again I ask: if with PHP is
possible to do the same things that traits included, why was it
included?
I'm not putting traits support inclusion on risk. I'm a string +1 to it.
All I want is that you stop giving stupid arguments to be against the
patch instead of giving *real* relevant arguments.
Regards,
On Tue, May 10, 2011 at 11:12 AM, Lars Schultz
wrote:
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.
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit:
http://www.php.net/unsub.php--
Guilherme Blanco
Mobile: +55 (16) 9215-8480
MSN: guilhermeblanco@hotmail.com
São Paulo - SP/Brazil