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

Reply via email to