Re: OOP - a question about database access

From: Doc O'Leary (droleary.usenet_at_subsume.com)
Date: 11/01/03


Date: Sat, 01 Nov 2003 03:32:40 -0600

In article
<D8yob.132399$h61.112745@news01.bloor.is.net.cable.rogers.com>,
 Tim <nocomment@rogers.com> wrote:

> If this is the wrong newsgroup, can someone please point me to the
> correct one and disregard this.

Right group, but that doesn't mean I'm going to be nice. :-)

> The columns in the table are date, home team, visitor team and starting
> time.
> (I'm going to use Java in a JDeveloper environment and the database is
> an MSAccess using a JDBC/ODBC bridge)

This is the data model; almost nobody needs to care how objects persist.
Your concern should be the object model, which you don't even hit on.

> So, how would you divide the various functions regarding interfaces,
> inheritance, etc.

Based on what they do and how they are used. You've failed to give any
indication of how the system will be used, so no useful objects can even
be guessed at, let alone how they might relate to one another.

> Does the object that represents a game's information have the methods to
> connect to the database, execute the query and retrieve the rows from
> the resultset or are they done in the calling program or elsewhere?

There is no "object that represents a game's information". There
*might* be a Game object, but what it is depends on what the system will
be doing. The persistence of said object is controlled by the object,
possibly by using a common mechanism/library for persistence.

> Does
> each column have it's own get method or do you pass all of the game's
> info to the calling class by a container once retrieved?

There are no columns in the object model. You need to stop thinking
about the data. This is especially true for what you have, which sounds
like a very flat data structure. That is, a "home team" is not the text
that is in the column, but is likely best normalized as a referenced
Team object.

> Do you get all
> rows of the result set from one call to the method of the object or do
> you use a GetNextRow method and check a return code?

No rows in the object model either. There might be a collection of
objects you'll use, but how that mapping happens depends on the
persistence mechanism. I've seen systems that load entire object trees
and I've seen systems that delay access to the stored data until an
object is actually used. What might be best for you depends entirely on
the details you haven't given.



Relevant Pages

  • Re: OOP - a question about database access
    ... >>(I'm going to use Java in a JDeveloper environment and the database is ... > Your concern should be the object model, which you don't even hit on. ... > possibly by using a common mechanism/library for persistence. ... I've seen systems that load entire object trees ...
    (comp.object)
  • Re: OOP - a question about database access
    ... >> Your concern should be the object model, which you don't even hit on. ... to reinvent database features from scratch, ... > The persistence of said object is controlled by the object, ... I've seen systems that load entire object trees ...
    (comp.object)
  • Re: DataSets Vs Object Model
    ... If you have a class that implements IComparer that has properties you can ... >> object persistence in a relational database. ... >> object model. ... >> complex object has to be saved to the database. ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: Persistence
    ... object models don't benefit from this flexibility. ... If an object model has several disadvantages compared ... you use a relational database for other things but persistence? ... If you don't need anything but persistence, ...
    (comp.object)