[AccessD] RE: Public/Private Property statements (WAS: <no su bject>)

Brett Barabash BBarabash at TappeConstruction.com
Mon May 19 08:44:59 CDT 2003


I agree completely with that concept, John.
But what about code WITHIN the class itself?  Do you refer to the
module-level variable, or the Property?


-----Original Message-----
From: John Colby [mailto:jcolby at colbyconsulting.com]
Sent: Friday, May 16, 2003 6:26 PM
To: accessd at databaseadvisors.com
Subject: RE: [AccessD] RE: Public/Private Property statements (WAS: <no
subject>)


Brett,

That is a good question.  The reason most often given for using properties
to get / set a private variable rather than dimming the variable public is
simply the ability to control access to the variable.  It goes back to the
global argument in essence.  By controlling writes through a let statement,
you can do parameter checking.  For example, suppose you are building a car
and you want a "doors" variable that says how many doors it has.  By feeding
it through a let statement, you can check that the value passed in is >0 and
<6 or something similar.  The question then becomes, if I don't have to do
any such checking do (should) I still use get / let?

Of course there are also times where you want to provide a read only value.
I.e. the value is set by some process and the value can only be read out.
The Acceleration of the car is determined by the weight, horsepower,
transmission, rear axle etc, all fed into a complex function and provided as
a readable value.  No "user" of the class should be able to write directly
to this variable.

And finally there are times (seldom but possible) where you want a write
only variable - password for example.

I try very hard to dim all class variables private and use property get /
let to read / write the value.  That way if later on I do want to restrict
access in any way, I simply go to my existing get / let and add the
functionality I desire.  The "interface" doesn't break because the user is
always forced to go through my properties.

John W. Colby
www.colbyconsulting.com

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com]On Behalf Of Brett Barabash
Sent: Friday, May 16, 2003 4:36 PM
To: 'accessd at databaseadvisors.com'
Subject: [AccessD] RE: Public/Private Property statements (WAS: <no
subject>)


That raises a good question, since I am not from the elite OO camp, I'd like
to know this:
Is it considered a bad practice to refer to the underlying variable within a
class directly?

Bryan, no need to apologize.  You may have stirred up an interesting
discussion, even if by accident.


-----Original Message-----
From: Charlotte Foust [mailto:cfoust at infostatsystems.com]
Sent: Friday, May 16, 2003 3:16 PM
To: accessd at databaseadvisors.com
Subject: RE: [AccessD]


Now I'm thoroughly confused as to whose head is being bashed and why.
You can create private Let and Get properties, although a private Get
seems pointless to me, since it will only be available within the class
module and you don't really need it there except maybe for symmetry.  A
private Let property, on the other hand, could be called and used within
the class itself, so it might be useful.  Now, which one of you was
wrong ... And about what???

Charlotte Foust

-----Original Message-----
From: Bryan Carbonnell [mailto:carbonnb at sympatico.ca]
Sent: Friday, May 16, 2003 11:44 AM
To: accessd at databaseadvisors.com
Subject: RE: [AccessD]


On 17 May 2003 at 1:05, Bruce Bruen wrote:

> However, re Bryan's comment - why can't the attribute value setting
> code be private - fundamentally it's an attribute that <u>cannot</u>
> be updated via this interface, but it does need to be visible to users

> of the class.  In this case the clubname is retrieved internally in
> the class - it is a header for the object.
>
> I don't believe that the public get/private let construct is
> syntactically incorrect.  However, is it philosophically incorrect?  I

It's not. I made a boo-boo.

All VB(A) programming has taken a back seat for me these days. PHP is
what I've been doing recently, so chalk it up to brain freeze.

Doh! (Bashes head against keyboard repeatedly) Doh! Doh! :)

Sorry 'bout that.

--------------------------------------------------------------------------------------------------------------------
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom
they are addressed.
If you have received this email in error please notify the
originator of the message. This footer also confirms that this
email message has been scanned for the presence of computer viruses.

Any views expressed in this message are those of the individual
sender, except where the sender specifies and with authority,
states them to be the views of Tappe Construction Co.

Scanning of this message and addition of this footer is performed
by SurfControl E-mail Filter software in conjunction with 
virus detection software.



More information about the AccessD mailing list