Hey all. I'm some classes to be part of an auction script.
I am going to have a "Bidder" object represent each bidder.
This object will give me all the details I need about each individual bidder.
But I also need to handle a group of bidders. For instance when someone is
viewing the auction page I want to show the list of bidders that bidded on that item.
So I need a class that manages a group of "Bidder" objects.
Is this what a collection class is for?
What I was thinking about doing was creating a "BidderList" class,
or something similar. The "BidderList" would probably take the auction ID as
a parameter in the constructor and load a bunch of "Bidder" objects, for each
bidder associated with that auction.
But I might allow some other alternative parameters for deciding which bidders to get.
For instance I might wanna get the bidders who've bidded in a particular category.
Or I may want to choose bidders based on some other criteria.
The "BidderList" class should be flexible enough to let that criteria change with
I was also thinking of having the "BidderList" class extend a "Collection"(or similar)
class. I can use that as an abstract class or interface to define a standard way of
doing things in case I want a collection of some other types of objects in
The "BidderList" class should give you the access to all the methods that
you would normally have on a "Bidder" object, must also need to include methods
for managing a list. Features such as iteration, etc..
So I have a few questions.
1. Am I on the right track with my thinking?
2. Is there a pattern or something I could look at to figure out how
to do this the right way?
3. What if there's a lot of bidders on a particular auction.
Isn't it inefficient to create all those objects?
It could make a difference on a high traffic site couldn't it?