T
thechaosengine
Hi everyone,
I've been looking at the various ways to create a data access layer recently.
There was one thing in particular that occured to me and I was hoping to
garner some experienced insight into the matter.
Some people create a DA component that requires instantiation before use.
For example:
DataAccessComponent dac = new DataAccessComponent(connectionString);
DataSet results = dac.GetLoggedInUsers();
Other people, myself included don't seem to see the point in actually going
to the trouble of instantiating an object to do this. We would actually just
use static methods:
DataSet results = DataAccessComponent.GetLoggedInUsers();
At first look, the instantiation of an object to do this sort of stuff doesnt
seem at all neccessary - static methods work perfectly fine.
So I'm wondering if I have over looked some aspect of this problem.
Can anyone imagine a (common) situation in which instantiation has definite
benefits over the use of static classes?
Thanks to anyone who can offer any advice
Kindest Regards
TCE
I've been looking at the various ways to create a data access layer recently.
There was one thing in particular that occured to me and I was hoping to
garner some experienced insight into the matter.
Some people create a DA component that requires instantiation before use.
For example:
DataAccessComponent dac = new DataAccessComponent(connectionString);
DataSet results = dac.GetLoggedInUsers();
Other people, myself included don't seem to see the point in actually going
to the trouble of instantiating an object to do this. We would actually just
use static methods:
DataSet results = DataAccessComponent.GetLoggedInUsers();
At first look, the instantiation of an object to do this sort of stuff doesnt
seem at all neccessary - static methods work perfectly fine.
So I'm wondering if I have over looked some aspect of this problem.
Can anyone imagine a (common) situation in which instantiation has definite
benefits over the use of static classes?
Thanks to anyone who can offer any advice
Kindest Regards
TCE