Phillip Gawlowski
1/30/2007 2:22:00 AM
Michael Fellinger wrote:
>
> This is just to show that Database itself should take responsibility
> over creation/checking. It's just a small example but should give you
> an idea.
> Tell, don't do :)
Ah, yes, that makes sense. I had to adapt your example to my needs, but
that is only a minor thing (I only use File to check if my SQLite
database is already existing, and if not, to have a set of SQLite
statements create it, which I probably place in their own class, as the
SQL can change, and this would provide easier maintenance, and a better
re-usability of the code, too).
Although this raises another question for me: Is it better to keep
functionality (i.e. everything that handles a database) into a class, or
to group functions into a class? The former keeps everything neatly in
one place, while the latter makes inheritance easier.
I lean towards a case-by-case basis, depending on the curcumstances of a
project, but to keep to stick with one option or the other (Phill's
PLOS, so to speak ;)
-Phill
--
Over by the window, lie the raiment and the weapons
That we need to take into this world today
Armoured by opinion, with statistic and schoolboy's charm
We take our place amongst the rank and file
Skyclad - A Survival Campaign