[AccessD] First real stumble with using VB.Net over VB

jwcolby jwcolby at colbyconsulting.com
Fri Apr 15 21:47:06 CDT 2011


 > OK.  A property is the the external name given to the state of one or more variables ( scalar or 
object) encapsulated within the class..

Why do you insist on tying it to at least one variable?  It isn't.

I have a flag class (in C#).  When that class instantiates, the constructor is fed a table, field 
and PK of a specific record and promptly loads the contents of that field into a variable.  The 
variable may be a date (when an event occurred) or an integer (one means that process occurred,  a 
zero means that process has not occurred).

That class has a boolean which can be read or set.  If it is set true, the property sets the 
variable "behind the scene" to either now() or 1 depending on the kind of flag it is.  Additionally 
the property set causes a function to execute which dynamically constructs a sql statement and 
writes the date or integer into SQL Server.

When you read the variable it returns the value associated with that flag, which is really a field 
in SQL server.

So the property is boolean, but the actual variable read / written can be either a date or an 
integer.  The property causes a fair bit of code to run which "interprets" something and returns a 
true / false.

In fact if I so desired I could make the "variable" the actual data in the field in the specific 
record in SQL Server.

This property exposes the boolean through a property (keyword) and that property is exposed to 
internal code of the parent object so that the parent object can read / write flags from SQL Server 
in a logical and consistent manner.

I could, if I so desired, cause the property to read a serial port and return a value on a strain 
gauge, or the temperature of a sensor in a machine, or a frequency of a phase lock loop, or a value 
of an Analog to digital converter or the value of 2/3 rounded to 4 decimal places...

In the end all you can really say about a property (get) is that it returns a unit of data.  You may 
or may not be able to set the value.  To call a register in a DToA a variable is a bit of a stretch, 
but if you insist that's fine.  But the value of 2/3?  No variables involved there.

A property get returns a value, a property let accepts a value and does something with it.  Storing 
it?  Not necessarily.  It may just feed it off to a machine somewhere which does something with the 
value.  It could fire a stepper motor, or set a voltage in a Digital to Analog converter, or it 
could pull in a relay and spray water all over your computer.  By the way that is a write only 
property which I lovingly call HoseTheTwitsdown.

;)

It is a property of the Colbyizer class which has many different properties to allow me to do 
everything from HoseTheTwitsDown to BoottheTwitsOutTheDoorAt20000Feet.

Don't make me use the more extreme properties.

:)

John W. Colby
www.ColbyConsulting.com

On 4/15/2011 8:15 PM, Stuart McLachlan wrote:
> OK.  A property is the the external name given to the state of one or more variables ( scalar
> or object) encapsulated within the class..
>
> There, that's fixed it :-)
>



More information about the AccessD mailing list