object.attribute vs. object.getAttribute()

Lulu of the Lotus-Eaters mertz at gnosis.cx
Mon Sep 15 21:27:44 EDT 2003


Roy Smith <roy at panix.com> wrote previously:
|1) Implicit documentation of which attributes I intended to be part of
|an object's externally visible state (accessors).

Some attribute names start with an underscore.  Those are the ones that
are NOT intended to be part of the external interface.

|2) Hooks to do data checking or invarient assertions (mutators).

Yep, you need accessors (or properties) to do this.

|3) Decoupling classes by hiding the details of data structures.

Initial underscores again.

|4) Vague feeling that I'm doing a good thing by being more in line with
|mainstream OO practices :-)

If you want to be mainstream, use VB.  But accessors are not IMO a
requirement for "proper" OOP.

Yours, Lulu...

--
    _/_/_/ THIS MESSAGE WAS BROUGHT TO YOU BY: Postmodern Enterprises _/_/_/
   _/_/    ~~~~~~~~~~~~~~~~~~~~[mertz at gnosis.cx]~~~~~~~~~~~~~~~~~~~~~  _/_/
  _/_/  The opinions expressed here must be those of my employer...   _/_/
 _/_/_/_/_/_/_/_/_/_/ Surely you don't think that *I* believe them!  _/_/






More information about the Python-list mailing list