Object Method Question

From: David Tillman <dtillman_at_ozarkaircraftsystems.com>
Date: Sat, 14 Jul 2001 14:24:59 -0500

  Hello all, I have an object foo that I want to pass various other
  objects, strings, numbers, whatever, to with different behavior.
  That is trivial.

  The part I am uncertain about is that I intend to pass it both
  single objects and lists of objects. Suddenly my carefully crafted
  methods fail because the item being passed is neither a bar-object
  not a baz-object - it is a list.

  So, should I:

    a. Make a container object for each type of object? I could
       have a string container object, a baz-object container object,
       etc. This would be pretty ugly as it would abandon using lists
       as an universal container. I would still be using a list, it
       would just be encapsulated inside an object so that the appropriate
       method for foo object would catch it.

    b. Only use one method for my foo object and do all of the type
       checking for baz-objects, strings, etc. manually.

    c. Separate the procedures out of the foo object's method definitions.
       Write the procedures to handle lists or atoms. Call the procedures
       from the foo object's methods as required. (One method would be for
       when foo was handed a list - check the class of the first atom and
       hand it of the required procedure.


  If you are wondering what I am trying to accomplish, I am reworking
  my stklos-html library. I have never been happy with the Table object
  an I now intend for the (append foo my-table) method to accept TR, TH,
  TD, string and numeric arguments - both atoms and lists.

  Thank you for your opinions,
  -Dave

--
David Tillman                      |  System Administrator
dtillman_at_ozarkaircraftsystems.com  |  Ozark Aircraft Systems
Received on Sat Jul 14 2001 - 21:25:51 CEST

This archive was generated by hypermail 2.3.0 : Mon Jul 21 2014 - 19:38:59 CEST