Heenan, Lambert
Lambert.Heenan at AIG.com
Mon Jun 12 08:13:07 CDT 2006
Well you don't call a nut and bolt a screw, even though it performs a similar task. But I appreciate that that is just semantic nit-picking. My *real* objection is the point about encapsulation. If you are going to use classes then one of their fundamentally useful features is the ability to *control* access to their data. This is most commonly done using Get and Set type properties. Declaring a couple of pubic member fields (or "properties" if you prefer) defeats that object. Lambert -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of DWUTKA at marlow.com Sent: Friday, June 09, 2006 5:13 PM To: accessd at databaseadvisors.com Subject: Re: [AccessD] Basic Unbound Form with Classes and Collections Par t 1. Why do you say they are not properties? They show up in intellisense as properties of the class. You can set and retrieve their values. I know what you are saying if you go into the object browser, you won't see the word property, however, from the code page you can't tell the difference. I also COMPLETELY understand the difference between them, but please keep in mind that this was a BASIC tutorial. It shows both diversity and is simple to code. I completely disagree with you on it defeating the purpose of data encapsulation. If a value is not going to have any work done on it at all, Public MyValue is just as efficient as a property Get and Let statement. (In fact, I would think it would be faster...but I'm just guessing there). Drew -----Original Message----- From: Heenan, Lambert [mailto:Lambert.Heenan at aig.com] Sent: Friday, June 09, 2006 4:01 PM To: 'Access Developers discussion and problem solving' Subject: Re: [AccessD] Basic Unbound Form with Classes and Collections Par t 1. <snip> Our table has three fields, so we'll create three easy properties, and a fourth which will be derived. So, in the code page type the following under the 'Option Compare Database' line: Public ID As Long Public FirstName As String Public LastName As String [ These are not properties at all, they are class member fields, and making them public is a Q&D solution which defeats the purpose of data encapsulation that classes offer. A real property Get and Set pair would correct this, with the member fields being change to Private] Lambert -- 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