![]() ![]() ![]() And for what? Just so you can store metadata in the same file as your code. If you use annotations, you fall into the problems I present here. Yes, I know in Symfony this approach is optional but the problems I highlight here are issues with annotations in principle, not only with this specific example. I'm going to use this routing class as an example, but all these issues are with annotations in general, not just Symfony's routing class. There are many reasons using annotations is a bad idea. It doesn't make them right and it certainly doesn't make them the best tool for the job. But so do global variables and singletons. Take Symfony's routing class example ( ) use Sensio \ Bundle \ FrameworkExtraBundle \ Configuration \ Route Ĭlass PostController extends indexAction () Those people developing such high profile frameworks should know better. People this is acceptable or a good practice, is frankly, ridiculous. However, how anyone can think that teaching There are increasingly more (mostly Symfony based) PHP projects out there that are making use of annotations for configuration (such as dependency injection and routing). They offer the developer a minor convenience at the expense of flexibility, encapsulation and various other traits we strive for as programmers. ![]() Annotations are in the same realm as global variables and singletons. ![]()
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |