I successfully managed to "autoload" objects: if I override the __get() method, I can just create the object. We seen that class autoloading does have advantage. But does object auto creating have too? Until now I had that object references (they both were private and public) and if I remove the reference, it becomes public automatic. And the other hand, code completition doesnt work anymore. I would say, this strongly ruin开发者_运维技巧 the object-class structure (no property). So, does it comes handy? Can I gain more speed with it?
You can under given circumstances gain a speedup, if you lazy-load objects from a database or a webservice, or anything that takes long to load. The speedgain does however not come from the __get or __set methods, but instead from avoiding to load data, that is not actually required. __get and __set are only language constructs that give you more opportunities.
精彩评论