in reply to One Big Script v. Several Small Scripts

The best solution goes like this:

Better to define two objects(in Perl, actually two mudules):
  1. one object for item, has at least two methods:
    1. one method to create it from query results, not being directly called, but called by the constructor of the second class.
    2. One method to display
  2. one object for list of items (this one contains a list/array/hash (your choice) of object of the first class as its attribute), has at least four methods defined:
    1. one method to add memeber
    2. one method to delete member
    3. one method to display all member elements (which are objects of the first class). This calls the display method of the first class for each member
    4. a method to create the list from a query (after it gets the query result, then call the constructor of the first class, to form each of its member element, and also call its own add method to append each member).
  • Comment on Re: One Big Script v. Several Small Scripts

Replies are listed 'Best First'.
Re: Re: One Big Script v. Several Small Scripts
by Cody Pendant (Prior) on Jan 29, 2003 at 09:07 UTC
    Thanks pg, that's very thoroughly laid out. I appreciate the details.

    Plus, bonus points for inventing the word "mudule".
    --

    “Every bit of code is either naturally related to the problem at hand, or else it's an accidental side effect of the fact that you happened to solve the problem using a digital computer.”
    M-J D