Re: OOP in database programming - Newbie question
- From: "Gary Lowe" <cincylap@xxxxxxxxxxxxx>
- Date: Fri, 22 Jul 2005 22:10:26 -0400
Delphi 5 pro
I have no formal Delphi training, but I have written several database
programs for inventory control. Basically they track containers and what is
in them and all data is accessed through database controls.
My question is this:
Is there any advantage to creating an object representing the container,
contents and it's location, manipulating this data and then passing the data
to a routine for inclusion into the database? It seems a little redundant
to me, but I really don't know the power or possibilities of the use of OOP
in this situation.
Any help or comments are welcome. Just be patient and understand that I am
not really a programmer in the true sense of the word.
Thanks
As the originator of this thread, I have found all of the replys so far to
be very useful. I was totally taken aback by how much is still under
discussion and debate. From all I have viewed so far, the idea of creating
objects to manipulate the data in a confined/structured environment makes
sense to me. What I am a little uncertain of is the linkage to the DB.
Here, this may be a matter of personal preference.
If I create a class representing the container ( box, bin, shelf, whatever)
and one class (or more) to represent the item(s) in the container, with code
in these classes to manipulate/manage all of the data contained within the
classes, that is centralizing the business logic, right?
Then if I create a form using standard controls (not DB controls) that
interact with these classes using setters/getters then should I also use a
DataModule for the form to interact with? This may not be at all clear so
let me give an example, then readers can give me an idea if I am on the
right track.
I have a data-entry form with all Non-DB controls. As I enter/select
information on this form, the data is processed and manipulated within the
classes using setters/getters. Within these setters/getters lies the code
to verify and modify data (such as making sure units of measurement are
compatable and if not, changing them so they are compatable). I have the
usual Save/Cancel buttons on this form. Is it then good form to use the
OnClick method of the Save button to interact with a DM to save the data to
the database?
I think I can see the advantage of doing things this way, but never having
done it, I can't see the pitfalls either. I am creating a desktop app (no
networking) and I can see where this approach might be over-kill, but I can
also see the advantages if I ever migrate to a network.
Hope this is clear to the reader and I am looking forward to any more
help/discussion on this topic.
.
- Follow-Ups:
- Re: OOP in database programming - Newbie question
- From: David Clegg
- Re: OOP in database programming - Newbie question
- From: Lauchlan M
- Re: OOP in database programming - Newbie question
- References:
- OOP in database programming - Newbie question
- From: Gary Lowe
- OOP in database programming - Newbie question
- Prev by Date: Re: OOP in database programming - Newbie question
- Next by Date: Re: Object Pascal Stigma, Useless Survey Question
- Previous by thread: Re: OOP in database programming - Newbie question
- Next by thread: Re: OOP in database programming - Newbie question
- Index(es):
Loading