[AccessD] OT: VBA.Net collections

John Colby jcolby at colbyconsulting.com
Thu May 15 20:26:20 CDT 2003


No, I was intending to add all of the Car functionality and properties into
a collection class subclassed (called) car, then add door classes into the
car collection class.  The alternative would be to build a car class, with a
colDoor as collection variable, then add the door classes into colDoor.

Using the first method, Car would have it's properties, color, weight etc.
Plus it would have an add method that accepted objects to add into the built
in collection.  The objects placed in this collection would be door classes.
The problem with doing this is that when referenced in place the syntax
would be deceiving.

Car(1) would actually reference a Door class stored in the collection when
it looks like a reference to some object stored in a car array.

Further if using an iterator, you would use something like:

for each door in car()
next door

Which actually isn't too bad.  However usually you would do something like:

For each door in car.colDoor()
next door

Still a little deceiving.

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: Thursday, May 15, 2003 8:28 PM
To: accessd at databaseadvisors.com
Subject: RE: [AccessD] OT: VBA.Net collections


I think your example would more properly require a Door class and a Doors
collection class which you'd subclass into your Car class to provide the
same syntax (Car.Door(1).Handle).

Jim DeMarco

-----Original Message-----
From: John Colby [mailto:jcolby at colbyconsulting.com]
Sent: Thursday, May 15, 2003 8:14 PM
To: accessd at databaseadvisors.com
Subject: RE: [AccessD] OT: VBA.Net collections


I absolutely understand what you are saying.  My thought was that part of
the functionality of this class was that it had to have a collection, thus
the "having a collection" was one of it's properties.  If I don't do what I
discussed, then I have to add a collection object variable.

However if thought of in terms of naming... let's just make up an example.

Let's call the class I am designing Car, and the objects placed in the
collection as doors.  If I don't use a variable pointing to a collection,
then the syntax to manipulate the doors (in place) would be Car(1).Handle
(for example).  If I use a variable, it would be Car.Door(1).Handle.  From
that perspective, the second (generally used) method is superior since the
first method makes readability obscure.

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: Thursday, May 15, 2003 7:53 PM
To: accessd at databaseadvisors.com
Subject: RE: [AccessD] OT: VBA.Net collections


John,

Although it seems like it may be the same difference I think it breaks the
philosophy (if you will) of class development.  If you design your classes
to handle one set of functionality (as class definition normally calls for)
then this would dictate keeping the object and all its methods and
properties and its collection with its methods and properties separate.

Just my opinion but I'd keep them separate (and do).

Jim DeMarco
(from home)

-----Original Message-----
From: John Colby [mailto:jcolby at colbyconsulting.com]
Sent: Thursday, May 15, 2003 5:38 PM
To: AccessD
Cc: VBA
Subject: [AccessD] OT: VBA.Net collections


I am looking at implementing some classes that have defined functionality
and properties.  However the class also needs a collection to hold other
items (instances of a specific class.  I read about the idea of subclassing
a collection to define the object that the collection can hold by overriding
the Add method.  Is there any reason not to just go the whole way and make
the collection class my object class.  IOW, add my methods and properties to
a subclassed collection class, naming the new class to MyObject.

John W. Colby
www.colbyconsulting.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".
****************************************************************************
*******

_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com





More information about the AccessD mailing list