Jim DeMarco
Jdemarco at hshhp.org
Mon May 19 09:27:50 CDT 2003
Haven't tested that theory but it makes sense. I wonder if that would have the effect in a fully compiled ActiveX (VB) component as opposed to a class module in Access? Jim DeMarco -----Original Message----- From: John Colby [mailto:jcolby at colbyconsulting.com] Sent: Monday, May 19, 2003 10:23 AM To: accessd at databaseadvisors.com Subject: RE: [AccessD] RE: Public/Private Property statements (WAS:<nosubject>) Hmm... that certainly works. I would be careful where I used it however as there is a speed penalty. Any function call has to build a stack, push objects onto the stack, and then return values back to the caller. If this is happening as the user types, who cares. If it is happening in a tight loop, 20000 times as the user twiddles their thumbs... John W. Colby www.colbyconsulting.com -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com]On Behalf Of Jim DeMarco Sent: Monday, May 19, 2003 10:10 AM To: accessd at databaseadvisors.com Subject: RE: [AccessD] RE: Public/Private Property statements (WAS: <nosubject>) I normally refer to the private variable too but I've also referred to the property by name. Why? Because if I have a large class with a lot of private variables/properties if I use Me.PropertyName syntax I can use the built-in Intellisense feature to grab the property name for me rather than ask "what was that variable called?". HTH, Jim DeMarco Director of Product Development HealthSource/Hudson Health Plan -----Original Message----- From: John Colby [mailto:jcolby at colbyconsulting.com] Sent: Monday, May 19, 2003 10:04 AM To: accessd at databaseadvisors.com Subject: RE: [AccessD] RE: Public/Private Property statements (WAS: <nosubject>) Within the class itself all code directly references the variable. If you think you are going to forget something and want to do the same filtering that outside users see, go ahead and use the properties. My assumption is that properties are for those dumb programmers using my object, not the dumb programmer creating my object. ;-) 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: Monday, May 19, 2003 9:45 AM To: 'accessd at databaseadvisors.com' Subject: RE: [AccessD] RE: Public/Private Property statements (WAS: <no subject>) 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. _______________________________________________ AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com _______________________________________________ AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com **************************************************************************** ******* "This electronic message is intended to be for the use only of the named recipient, and may contain information from Hudson Health Plan (HHP) that is confidential or privileged. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution or use of the contents of this message is strictly prohibited. If you have received this message in error or are not the named recipient, please notify us immediately, either by contacting the sender at the electronic mail address noted above or calling HHP at (914) 631-1611. If you are not the intended recipient, please do not forward this email to anyone, and delete and destroy all copies of this message. Thank You". **************************************************************************** ******* _______________________________________________ AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com _______________________________________________ AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com *********************************************************************************** "This electronic message is intended to be for the use only of the named recipient, and may contain information from Hudson Health Plan (HHP) that is confidential or privileged. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution or use of the contents of this message is strictly prohibited. If you have received this message in error or are not the named recipient, please notify us immediately, either by contacting the sender at the electronic mail address noted above or calling HHP at (914) 631-1611. If you are not the intended recipient, please do not forward this email to anyone, and delete and destroy all copies of this message. Thank You". ***********************************************************************************