Not for 'how-to' coding questions but PHP theory instead, this forum is here for those of us who wish to learn about design aspects of programming with PHP.
d11wtq wrote:
These methods come in really useful at times. I use __get() and __set() in my abstract View component (just like many others do), but I also provide setVar() and getVar() in the View too. They're just convenience methods really.
I think arborint's point was that the implementation is sketchy. C#'s "properties" are a much nicer implementation of basically the same functionality.
Ah sorry, I misunderstood
C# is something I've yet to look at but have always felt held back by the fact I'm not a Windows guys and Mono confused the hell outta me
d11wtq wrote:C# is something I've yet to look at but have always felt held back by the fact I'm not a Windows guys and Mono confused the hell outta me :P
Ah, that's clever. It's like a refactored (albeit syntactically different) equivalent, more targetted at specific fields.
Thanks for the example, I agree that __get() and __set() do not do such a good job of this. I think the PHP developers are hard pushed to add new rules to the simplistic PHP syntax though. I suspect this is the same reason they are still faffing about with namespaces and leaving us wondering if they'll actually implement them.
You can direct calls to __get() and __set() with a simple swicth but I admit it's less readable than the approach C# have taken.
Apologies for derailing a thread about autoloading ~Everah
kyberfabrikken wrote:I think arborint's point was that the implementation is sketchy. C#'s "properties" are a much nicer implementation of basically the same functionality.
Thanks kyber for the clarification and the excellent example.
For the record, I am not saying that I know that the current implementation is not the best one. And I admit it is workable and getting more workable. I think my concern comes from my belief that good design comes from implementation knowledge. Because I have watched Zend "learn as the go" about OOP and enterprise patterns like MVC as they build their framework -- and still not quite get it -- I am suspicious of their solutions in this area. However the chances that I am completly incorrect are, as usual, high.