| 
	
 | 
 Posted by Vince Morgan on 04/22/07 09:32 
"Jerry Stuckle" <jstucklex@attglobal.net> wrote in message 
news:PI-dnRXMkqxCwLTbnZ2dnUVZ_qupnZ2d@comcast.com... 
> Vince Morgan wrote: 
> > "Steve" <no.one@example.com> wrote in message 
> > news:zGbWh.1456$go5.566@newsfe12.lga... 
> > You are undoubtedly aware that this has to be the most misunderstood 
> > behaviour in all of php.  Perhaps in all programing in all languages!! 
The 
> > number of posts I've read in the last few hours that clearly 
misunderstand 
> > _set() and __get() is astonishing!  And all I've gleened from them was 
> > further misunderstanding. Cant blame them realy.  You have been trying 
to 
> > hammer the point home but the nails have just kept bending.  I don't 
think 
> > I've ever been so confused about anything in my life. 
> > Thank you!! 
> > You have my undying grattitude Steve! :))) 
> > Vince 
> > 
> > 
> 
> Vince, 
> 
> It's probably misunderstood because it's pretty much a violation of OO 
> principles.  OO principles indicate you can set and get values - but 
> that you have separate setter and getter functions for these. 
> 
> Now you can emulate this in other OO languages such as Java, C++ and 
> SmallTalk.  But it's pretty much frowned upon.  Experienced programmers 
> in these languages pretty much follow the defacto standard to have 
> separate getter and setter functions of each value you want to be able 
> to change/retrieve. 
> 
> Doing it other ways just gets into too much of a hassle. 
> 
> Now PHP has tried to implement something which really is against OO 
> principles (so what's new here?). 
> 
> I've looked at it - but I really don't find it useful.  This style is 
> not implemented in other languages for very good reason - it really 
> complicates the code, just as these functions do in PHP. 
> 
 
I know I don't have to tell you that it certainly confused me.  I was quite 
stunned when I first saw that you could add methods to a js object. 
However, as you don't have access to the source of those classes I can 
understand why some consider it a whorthwhile feature. 
However, in the case of php where you do have such access it seems ludicrous 
to me to do such a thing.  If someone wants to add additional functionality 
to a php object, why not simply write it into the class?  Treating them as 
if they are compiled objects seems more than a little silly to me.
 
  
Navigation:
[Reply to this message] 
 |