Re: [PHP] Attributes vs. Accessors

2008-08-25 Thread Eric Butera
On Mon, Aug 25, 2008 at 11:01 AM, Richard Heyes <[EMAIL PROTECTED]> wrote: >>> Curious. Which do you prefer and why? > > Accessor methods. They allow for changes in the future that may well > be unforeseen at the moment. Or at least that would be my response > with PHP4. Now with the __get and __se

Re: [PHP] Attributes vs. Accessors

2008-08-25 Thread Richard Heyes
>> Curious. Which do you prefer and why? Accessor methods. They allow for changes in the future that may well be unforeseen at the moment. Or at least that would be my response with PHP4. Now with the __get and __set built-in accessors, that's pretty much taken care of. > I access directly to avo

Re: [PHP] Attributes vs. Accessors

2008-08-25 Thread Eric Butera
On Mon, Aug 25, 2008 at 8:32 AM, Philip Thompson <[EMAIL PROTECTED]> wrote: > Hi all. > > Curious. Which do you prefer and why? > > class Hello { >public $hi; > >function __construct () { >$this->hi = 'Well Hello There!'; >} > >function hi () { >return $this->hi; >

Re: [PHP] Attributes vs. Accessors

2008-08-25 Thread Stut
On 25 Aug 2008, at 13:54, Christoph Boget wrote: ]Curious. Which do you prefer and why? For publicly-declared variables, do you access the attribute directly or use an accessor? If it's a public member variable there is no need for plain accessor methods - they add no value. I feel the same

Re: [PHP] Attributes vs. Accessors

2008-08-25 Thread Philip Thompson
On Aug 25, 2008, at 7:54 AM, Christoph Boget wrote: Curious. Which do you prefer and why? For publicly-declared variables, do you access the attribute directly or use an accessor? If it's a public member variable there is no need for plain accessor methods - they add no value. I feel the sa

Re: [PHP] Attributes vs. Accessors

2008-08-25 Thread Christoph Boget
>> Curious. Which do you prefer and why? >> For publicly-declared variables, do you access the attribute directly or >> use an accessor? > If it's a public member variable there is no need for plain accessor methods > - they add no value. I feel the same about private variables with plain get > and

Re: [PHP] Attributes vs. Accessors

2008-08-25 Thread Stut
On 25 Aug 2008, at 13:32, Philip Thompson wrote: Curious. Which do you prefer and why? hi = 'Well Hello There!'; } function hi () { return $this->hi; } } $hello = new Hello (); // Access the value this way... echo $hello->hi; // or the accessor... echo $hello->hi(); ?> For p

[PHP] Attributes vs. Accessors

2008-08-25 Thread Philip Thompson
Hi all. Curious. Which do you prefer and why? hi = 'Well Hello There!'; } function hi () { return $this->hi; } } $hello = new Hello (); // Access the value this way... echo $hello->hi; // or the accessor... echo $hello->hi(); ?> For publicly-declared variables, do you ac