Re: beginner - stuck on data storage

From: Universe (no email)
Date: 10/30/04


Date: Sat, 30 Oct 2004 03:52:18 -0400


"Kavvy" <kav@kav.kav> wrote:

> I've recently completed the UK Open University course M206 (Computing and
> Object Oriented Approach) which uses Smalltalk and a take on UML to teach OO
> design and programming.
>
> Upon putting my new skills to practice I've hit upon a problem that the
> course never got as far as explaining. How do you actually manage the
> storage and retreval of objects to make them persist. I'm using SQL and C#,
> and have got as far as guessing that the way forward is some kind of class
> that manages the actual data access to SQL.
>
> However, I'm not sure if I'm supposed to have one class that handles it all
> and then each class uses that. Or do you implement data access into each
> class that requires it?

In almost *any* paradigm you want a *set* of database objects in layer that sites between your OO
domain model and relational database.

Often you want at least 1 class per table. However you may want to create objects that combine data
from multiple objects or that does executes a stored procedure hidden from your OO domain model.
Your OO domain model might send the object data via method arguments, the object runs a stored
procedure, and then your OO domain model uses returned data.

This strategy means for nearly *any* technology - JEEE, CORBA, .Net - that your app will have at
least 3 layers:

Interface
----------
Domain OO model
--------
Relational database

For 3 or n-tier using M$ technology check this out at:
http://www.microsoft.com/downloads/details.aspx?familyid=6eb67f59-d075-4b28-b3c4-e9294ff3cf4a&displaylang=en

*****************************
Visual Basic .NET Code Sample: N-Tier Data Form and Data Layer
This sample shows you how to build an N-Tier data application. This demonstrates the use of a 3-Tier
system, using SQL Server or MSDE as a back end (accessing the Northwind database), a data access
layer middle tier, and a data-bound form as the front end.

Quick Info
File Name:
 n-tierdataformanddatalayer.exe
 
Download Size:
 103 KB
 
Date Published:
 7/29/2002
 
Version:
 1.0
************************************************

> Also :)
>
> Considering that the way I've been taught suggests that a system contains
> all the instances of objects that are currently created, this implies that
> you load all the previously created objects from your database upon
> execution of the application, and then save whatever objects are left at the
> end? If this is the case, then what is the best method to store an objects
> relationship with another?

Why load *all* instances at the start for *every* app.?

If you can speed things up by only loading 1 or a few then only load 1 or a few. No one's gonna
shoot you and I've never heard all instances should be created and loaded at run-time start. Some
do it for speed *IF* they have the RAM to hold it, or the disk space to hold a number of already
created, "rehydrated" object instances in a disk cache and thus avoid facing database processing and
object "rehydration" at later time.

Elliott

-- 
      Theory Leads, Practice Verifies
Global Plans + Iterative/Incremental Development
        Profiteer US Out of Iraq Now!


Relevant Pages

  • Re: OOP question --- theoretically speaking....
    ... >database access components, you have to rewrite your class all over again. ... >It really is better and more beneficial to have a separate data layer that ... initially hosted each tier as serviced components and serialised chunks ... of the domain model out to the web UI layer via a service layer (kind of ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Looking for a decent data access architecture to implement
    ... > application so that there is a clean separation between the data access ... > layer, the business layer and the GUI layer. ... > the actual database. ...
    (microsoft.public.dotnet.languages.csharp)
  • Looking for a decent data access architecture to implement
    ... application so that there is a clean separation between the data access ... layer, the business layer and the GUI layer. ... the actual database. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: "Business Objects" and the DAL
    ... layer talks to the layer next to it. ... business entity returned that up to the UI for binding to a grid. ... If a database table column names ... Each could be considered a "pattern", ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: Size matters to some
    ... The underlying remote database connection ... physical layer is actually managing it all, the logical layer is forced to ... constraints as specified by developers. ... want to validate the information getting written. ...
    (comp.databases.pick)