RE: [PHP-DEV] On how a little knowledge is completely useless.
| From: | Jonathan Bond-Caron | Date: | Fri, 17 Sep 2010 18:57:11 +0000 |
| Subject: | RE: [PHP-DEV] On how a little knowledge is completely useless. | ||
| References: | 1 2 3 4 5 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-49760@lists.php.net to get a copy of this message | ||
On Fri Sep 17 01:06 PM, Guilherme Blanco wrote:
>
> Another good example is to map your persistence data into your
> Entities. Doctrine 2 implements this and I think that way you can
> compare easily with the PHP code alternative. I'd like to ask you to
> compate the same Entity mapped through Annotations emulator and using
> raw PHP code:
> CmsUser using Annotations:
>
> http://github.com/doctrine/doctrine2/blob/master/tests/Doctrine/Tests/
> M
> odels/CMS/CmsUser.php
> CmsUser using PHP code:
>
> http://github.com/doctrine/doctrine2/blob/master/tests/Doctrine/Tests/
> O RM/Mapping/php/Doctrine.Tests.ORM.Mapping.User.php
>
You're basically bundling (M: Model, data & configuration, C: Control, business logic /
code) into a single class while the MVC pattern is all about separating M,V and C.
What's wrong with a simple configuration file? Caching the parsed config in shared memory?
One important flaw rarely mentioned with annotations config: your code now depends on framework X to
read the annotations instead of a simple configuration file (.xml, .ini., ...)
Sorry if I might sound harsh but configuration through annotations is terrible.
You'll find many .net or java developers that agree, I'd say it's 50-50 if not more
70-30.
Does this discussion still belong in internals? We could argue about this for months, java
astronauts don't even agree how annotations are useful:
http://www.javaworld.com/community/node/2613