Re: OOP - a question about database access

From: Tim (nocomment_at_rogers.com)
Date: 11/01/03


Date: Sat, 01 Nov 2003 15:28:33 GMT

Doc O'Leary wrote:

> 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.
>
Well, that was the question. I think it should be obvious how the data
will be used and I wanted to know, given the simple example, how you
would set up the various objects to manipulate this simple table. In
this case, the table has been populated already and it was just an
access situation.
What type of objects are necessary and what are their basic functions
for database access?

>
>>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.

Do you spend you whole life talking like this? What do you actually
think this data would be used for? Be creative!

   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
    ... Your concern should be the object model, which you don't even hit on. ... possibly by using a common mechanism/library for persistence. ... a "home team" is not the text ... 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: OOP style
    ... Component classes have all their main logic in a Custom base class ... database access unit if they didn't already start with a full DB layer; ... My latest application started with an extensively designed object model ... Typing in the implementation of the database interface is ...
    (comp.lang.pascal.delphi.misc)
  • Re: ORM or JDBC?
    ... Classes implementing user interface are not an object model *for the ... It would be silly to map a Button or a Panel to a row in a database ... But you want to store the data in the database, not the layout of the GUI ...
    (comp.lang.java.programmer)
  • Re: If you were developing a database in Forth...
    ... but apparently there is a lack of imagination. ... He specifically asked about persistence, ... "reflexively" reaches for a database engine ... him to "imagine" iterating over the dictionary, outputting Forth ...
    (comp.lang.forth)