Hi all, a request for opinions, please.
I am designing a smallish application to manage members of several
committees of a particula Organization. The structure of the system is as
follows:
theOrganization
contains Committees
which in turn contain People
So theOrganization object is a list of Committee objects which are
themselves groups of People objects.
Now, to get the data out of the MySQL database, it is probably more
efficient to do as few SQL selects as possible. Efficient from a speed
point of view. However, from a coding/OO-style point of view, it makes
more sense to have each People object be defined as *one* person -- but
that would mean that each has data for only one person and that would mean
a separate SELECT statement for each People object created. (Assuming that
there is a SQL SELECT in the constructor of each People object or
something similar to that).
Traditionally (i.e. non-OO), to code this, I would do as few SQL calls as
possible. But I can't see how to do that from an OO point of view.
For example, does it make sense to put all the people data into an array
outside of the People class and use this list to set up the class
constructor? (It doesn't make sense to me)
Or, for example, does it make sense to have the People class just be a
list of *everyone* in the people table? (This too does not make sense to
me)
On the other hand, what is the performance impact if I *do* make each
People class instance be only *one* person?
Allright, I hope this makes some sense. Thanks (in advance) for the advice!
--
Jeffrey D. Silverman | jeffrey AT jhu DOT edu
Johns Hopkins University | Baltimore, MD
Website | http://www.wse.jhu.edu/newtnotes/