PHP5 - OO extensions and naming conventions.

php.internals

l0t3k

23 years ago
IIRC there was an informal consensus to use studlyCaps as the official userland convention for OOP extensions (*) (leaving aside the case insensitivity of the language.) my question now concerns accessors. should we prefer properties over propertyGet()/propertySet() accessor functions ? would having both constitute bloat. i ask because im implementing a series of classes mirroring those in the Caffeinated Language (tm) so familiarity could be an asset. l0t3k (*) i wonder if this should be more formalized before the next major release. major extensions like dom/xsl are already using the current method->function_ name() convention.

Andi Gutmans

23 years ago
At 10:37 AM 2/7/2003 -0400, l0t3k wrote:
>IIRC there was an informal consensus to use studlyCaps as the official >userland convention for OOP extensions (*) (leaving aside the case >insensitivity of the language.) >my question now concerns accessors. should we prefer properties over >propertyGet()/propertySet() accessor functions ? would having both >constitute bloat. i ask because im implementing a series of classes >mirroring those in the Caffeinated Language (tm) so familiarity could be an >asset. > > >l0t3k >(*) i wonder if this should be more formalized before the next major >release. major extensions like dom/xsl are already using the current >method->function_ name() convention.
I definitely prefer setXXX()/getXXX() functions over property overloading. Andi

Sterling Hughes

23 years ago
On Wed, 2003-07-02 at 14:24, Andi Gutmans wrote:
> At 10:37 AM 2/7/2003 -0400, l0t3k wrote: > >IIRC there was an informal consensus to use studlyCaps as the official > >userland convention for OOP extensions (*) (leaving aside the case > >insensitivity of the language.) > >my question now concerns accessors. should we prefer properties over > >propertyGet()/propertySet() accessor functions ? would having both > >constitute bloat. i ask because im implementing a series of classes > >mirroring those in the Caffeinated Language (tm) so familiarity could be an > >asset. > > > > > >l0t3k > >(*) i wonder if this should be more formalized before the next major > >release. major extensions like dom/xsl are already using the current > >method->function_ name() convention. >
This was formalized. studlyCaps were agreed upon. DOM adheres to the DOM standard, so that's a special case. ext/xsl should be changed. -Sterling
> I definitely prefer setXXX()/getXXX() functions over property overloading. > > Andi
-- "Programming today is a race between software engineers stirring to build bigger and better idiot-proof programs, and the universe trying to produce bigger and better idiots. So far, the universe is winning." - Unknown

Jason Greene

23 years ago
On Wed, 2003-07-02 at 13:24, Andi Gutmans wrote:
> I definitely prefer setXXX()/getXXX() functions over property overloading. > > Andi
I agree, but I am usually of the mindset that all properties should be private, and should always have accessors (unless of course there is a performance issue with the particular application) -Jason
-- Jason Greene <jason@inetgurus.net> <jason@php.net>