T
tecknick
OK I have a design issue with Data Access for Custom Collections and I
am hoping someone could point me in the right direction.
There are a large number (10 +) applications to be designed and all
seem to present and manipulate the same data in a huge variety of ways.
The client has indicated that there will be ongoing changes with the
data being collected so the application framework needs to allow for
easy updates of code and also needs to be extremely efficient in terms
of speed.
One chooses to go down the custom collections path and has decided to
split their INITIAL application into the following layers as follows :
- Presentation
- Business Objects (business objects and collections)
- Business Logic (business object/collection helper classes)
- Data Access (business object/collection data access)
So the BO, BL and DA layers will be reused across all applications.
Now for my DA issue!
I am going to use a very simple example to try and illustrate the
issue. If one has a few BO's as follows :
- ServiceCentre (A service centre for automobiles)
- MobileMechanic (A mechanic who works on the road)
- ServiceArea (The area that a mobile mechanic services)
- Suburb (An actual suburb that can be serviced or where a
service centre exists)
Where:
- One ServiceCentre has many MobileMechanic's
- A MobileMechanic belongs to one ServiceCentre
- A MobileMechanic has one Service Area
- A Service Area has one Mobile Mechanic
- A Service Area has many Suburb's
- A Suburb has only one ServiceArea
- A ServiceCentre is in one Suburb
Now from the above we create our 4 BO's and 2 collection (one for
MobileMechanic and the other for Suburb).
Keeping in mind that this is a very small example and the real world
example will be a few hundred BO's.
leaning toward a design where each BO has its own DA class/object (eg
the Suburb object in BO has a SuburbData object in DA). The reason for
having a DA object for each BO object is to centralise the access of
the data for the BO objects. In doing this, if the client indicates
that they would like to add a special telephone number for each suburb,
then we can easily add this attribute to the Suburb BO object and only
need to extend any code in the SuburbData DA object to ensure that the
data comes through into the BO object from the DB.
By doing this when a ServiceCentre object is filled with data, there
will be the use of ServiceCentreData object and also the SuburbData
object. When a ServiceArea is filled with data, there will be the use
of the ServiceAreaData object and the SuburbData object(mulitple
times).
But this presents a problem as it starts to bite into the performance.
In doing the data access in this way instead of using only one DB
connection/access to get ServiceArea object data (a data reader with
multiple select statements loading up the ServiceArea object and
collection of Suburb object) we are now
using 2+ DB connection/access to get the data.
Again, keep in mind that this is a very small example and that in the
real world example there are some objects which contain approximately
20 to 30 other object to hold the data that they require.
Any suggestions on how to overcome my dilemma or is the additional DB
connection/access overhead introduced by the clean design negligible?
Thanks in advance.
Tecknick
am hoping someone could point me in the right direction.
There are a large number (10 +) applications to be designed and all
seem to present and manipulate the same data in a huge variety of ways.
The client has indicated that there will be ongoing changes with the
data being collected so the application framework needs to allow for
easy updates of code and also needs to be extremely efficient in terms
of speed.
One chooses to go down the custom collections path and has decided to
split their INITIAL application into the following layers as follows :
- Presentation
- Business Objects (business objects and collections)
- Business Logic (business object/collection helper classes)
- Data Access (business object/collection data access)
So the BO, BL and DA layers will be reused across all applications.
Now for my DA issue!
I am going to use a very simple example to try and illustrate the
issue. If one has a few BO's as follows :
- ServiceCentre (A service centre for automobiles)
- MobileMechanic (A mechanic who works on the road)
- ServiceArea (The area that a mobile mechanic services)
- Suburb (An actual suburb that can be serviced or where a
service centre exists)
Where:
- One ServiceCentre has many MobileMechanic's
- A MobileMechanic belongs to one ServiceCentre
- A MobileMechanic has one Service Area
- A Service Area has one Mobile Mechanic
- A Service Area has many Suburb's
- A Suburb has only one ServiceArea
- A ServiceCentre is in one Suburb
Now from the above we create our 4 BO's and 2 collection (one for
MobileMechanic and the other for Suburb).
Keeping in mind that this is a very small example and the real world
example will be a few hundred BO's.
uses a collection of Suburb object. In designing the DA Layer we areFrom this, a ServiceCentre uses the Suburb object and the ServiceArea
leaning toward a design where each BO has its own DA class/object (eg
the Suburb object in BO has a SuburbData object in DA). The reason for
having a DA object for each BO object is to centralise the access of
the data for the BO objects. In doing this, if the client indicates
that they would like to add a special telephone number for each suburb,
then we can easily add this attribute to the Suburb BO object and only
need to extend any code in the SuburbData DA object to ensure that the
data comes through into the BO object from the DB.
By doing this when a ServiceCentre object is filled with data, there
will be the use of ServiceCentreData object and also the SuburbData
object. When a ServiceArea is filled with data, there will be the use
of the ServiceAreaData object and the SuburbData object(mulitple
times).
But this presents a problem as it starts to bite into the performance.
In doing the data access in this way instead of using only one DB
connection/access to get ServiceArea object data (a data reader with
multiple select statements loading up the ServiceArea object and
collection of Suburb object) we are now
using 2+ DB connection/access to get the data.
Again, keep in mind that this is a very small example and that in the
real world example there are some objects which contain approximately
20 to 30 other object to hold the data that they require.
Any suggestions on how to overcome my dilemma or is the additional DB
connection/access overhead introduced by the clean design negligible?
Thanks in advance.
Tecknick