N
NXY
I'm developing a db to handle biological data and it will require the
abililty to store and manage time periods of activity for pieces of
equipment. Thes periods are stored in a table with fields holding PeriodID,
PeriodStart and PeriodEnd among other fields.
To handle the time periods in code I've created a Period class with methods
allowing me to .Add a new period and .Delete a period for example. In
addition I've created a Periods collection to enable me to create and handle
groups of periods based on a time window. The collection class has a Refresh
method to populate a group (by runnng a query on the underlying storage
table) and Remove method to remove a period from the group. (.Add method
have various parameters which map to the underlying fields to
define/identify the new period to be added or deleted).
I'm probably still not thinking in a properly OO way, but I'd appreciate
advice on the recommended way of using such classes.
For example, if I need to create a completely new Period should I use the
[Period.Add] (to actually create the new record in the underlying table),
followed by a [SomePeriodCollection.Refresh] to update a collection, or,
call SomePeriodCollection.Add which itself calls [Period.Add] to add the new
record and then updates the collection. A similar situation arises when
deleting; do I delete the period [Period.Delete] then refresh collection
(running SQL) or use the Periods.Remove to both delete the record from the
underlying table (by calling Period.Delete) then refreshing the collection.
Nigel
abililty to store and manage time periods of activity for pieces of
equipment. Thes periods are stored in a table with fields holding PeriodID,
PeriodStart and PeriodEnd among other fields.
To handle the time periods in code I've created a Period class with methods
allowing me to .Add a new period and .Delete a period for example. In
addition I've created a Periods collection to enable me to create and handle
groups of periods based on a time window. The collection class has a Refresh
method to populate a group (by runnng a query on the underlying storage
table) and Remove method to remove a period from the group. (.Add method
have various parameters which map to the underlying fields to
define/identify the new period to be added or deleted).
I'm probably still not thinking in a properly OO way, but I'd appreciate
advice on the recommended way of using such classes.
For example, if I need to create a completely new Period should I use the
[Period.Add] (to actually create the new record in the underlying table),
followed by a [SomePeriodCollection.Refresh] to update a collection, or,
call SomePeriodCollection.Add which itself calls [Period.Add] to add the new
record and then updates the collection. A similar situation arises when
deleting; do I delete the period [Period.Delete] then refresh collection
(running SQL) or use the Periods.Remove to both delete the record from the
underlying table (by calling Period.Delete) then refreshing the collection.
Nigel