News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Jake Bell:
PHP Annotations Are a Horrible Idea
October 18, 2012 @ 09:45:56

In his latest post Jake Bell talks about why he thinks annotations in PHP are a bad idea (not the concept of them, but how developers are currently using them. He's in favor of officil support though).

Both the Symfony 2 and Doctrine 2 libraries and components make liberal use of what have come to be called annotations - special code comments, usually prefixed with an @ that are actually interpreted by the application and affect its functionality. [...] This trend needs to die.

He points out that the use of code comments like this isn't a good practice and applications should never have to rely on them for functionality. He mentions issues with syntax/language functionality (can't use "php -l" on them, can't var_dump an annotation) and that it makes it more difficult to read and interpret the code. He includes an example from Ruby of an alternative and a possible solution in PHP involving a static "mapping" variable.

0 comments voice your opinion now!
annotations code comments opinion doctrine symfony


blog comments powered by Disqus

Similar Posts

Reddit.com: Composer still susceptible to remote code execution via MITM

Community News: FixThatCode.com Launched

Jani Hartikainen's Blog: A simple way to make your code better: Stop adding more parameters

Expert Developer: Install PHP CodeSniffer on Windows Machine

John Hamelink's Blog: Top codeigniter libraries I can't live without.


Community Events





Don't see your event here?
Let us know!


threedevsandamaybe framework developer api podcast introduction series language release interview configure application wordpress list symfony community unittest library code install

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework