|
|
|
|
|
by Joeri
5000 days ago
|
|
I've just ported java's bean vaidation to PHP using annotations in comments, and I strongly disagree. Point by point: 1. dx regressions I've designed the annotation system so that if developers misdeclare them an exception is thrown. Unit tests will fail, and the software will not run. Someone checking in code that fails to such a degree deserves what's coming to them. That covers php -l. Var_dump and debug_backtrace are irrelevant to my use case, and I use proper breakpoints and watches anyway (phpstorm + zend debugger). I don't even understand the point he's trying to make about IDE linking. Which leaves the argument about comment folding, which I think has some merit, if you think comments shouldn't be read, which I don't. 2. Readability Nonsense. Learning an API always requires getting used to its idiosyncracies. His proposal to use static variables looks less readable to me. 3. Reliance on another library Yes, that's kind of the point. 4. Icky feeling Aha, bingo. The author came in with the opposite bias of myself and drew an according conclusion. To conclude: the use of annotations in comments is not better or worse than alternatives, it's all in the eye of the beholder. |
|