in reply to OO Application Design
I have always gone with the class method version, i.e., $person->getAdults(); This way seems to require less code upfront. Typically I put all of the class methods that are generic (including the actual DBI connection handle) into a single Package file and use that file from the perl program. That way once you get all your class methods written, you don't have to touch them again while your're messing with the perl program that uses them.
That said, if you have a huge amount of data returned by the calls to your class methods, it may be better to create a separate class that only knows about, in this case, people. That could be used to reduce the amount of data you fetch when you only need a certain small portion of the data.
|