OO and RDBMS design decision
- From: Rich <f@xxxxxxxxx>
- Date: Sun, 07 Aug 2005 13:30:11 GMT
Say for example I have a Computer class has a table that contains the
information about a basic computer (ie serial number, make, model), and
there are other tables such as one that relates the serial number to a
network name, and another that relates the serial number to an employee
payroll number (for computer allocation), and then an employee table that
contains (payroll number, name).
Is it better to have one class representing one table (DAO), and then
another class that retrieves the necessary information from various tables
to build my object? - so ComputerFactory would request information from
ComputerDAO, NetworkNamesDAO, AllocationDAO and EmployeeDAO. (The DAO
classes contain the actual SQL queries)
Or should I simply go for one class that does both jobs in that it queries
multiple tables to build my object? So ComputerFactoryDAO would create and
return Computer objects after querying all the tables.
On the one hand the first option seems more versatile in that I could reuse
the DAO classes for other queries. On the other hand the second option is
simpler.
I would appreciate some thoughts on this.
Best regards,
Rich.
.
- Follow-Ups:
- Re: OO and RDBMS design decision
- From: Alvin Ryder
- Re: OO and RDBMS design decision
- From: H. S. Lahman
- Re: OO and RDBMS design decision
- From: Daniel Parker
- Re: OO and RDBMS design decision
- Prev by Date: Re: Bitwise Mag editorial calls OOP 'Snake Oil'
- Next by Date: Re: Bitwise Mag editorial calls OOP 'Snake Oil'
- Previous by thread: Requirement taxonomy
- Next by thread: Re: OO and RDBMS design decision
- Index(es):
Relevant Pages
|