Long Post!


  This isn't 100% on-topic Ruby wise - please bear with me
  as Ruby users are the type of people I'm interested in
  hearing input from.

  Three topics:

  1. The reply from David Alan Black (ruby-talk:18683) got me
  to thinking a bit about object design.  When two objects
  interact, how do you decide which object handles the interaction?

  It could be that a good OOP design book would clear this up for me,
  _Design_Patterns_ perhaps?

  Example: in my HTML (HTMLoop) library for Ruby you can either pass
  an Array to a Table object or you can tell an Array to output itself
  as a table.  (I think it is convenient to have both as myArray.table
  returns a string immediately but the Table object waits for a puts,
  to_s, etc.)

  When should something be a method and when a function?

  'Some String'.color('#dd3333') or   color ('Some String', '#dd3333')?


  2. Am I reinventing the wheel here by porting HTMLoop to Ruby?

  I can't seem to find one on the RAA.  The methods in CGI don't
  quite cut it - I like *readable* cgi scripts.
  (not so much nesting (if you know what I mean))

  An example is at:

     http://www.ozarkaircraftsystems.com/~dtillman/cgi-bin/ruby.cgi

  This is not a very complex example as 75% of the objects (cgi list
  boxes, etc.) are broken due to revamping how I am simulating
  keywords. Criticism is welcome - just keep in mind that I just
  started coding in Ruby last Monday

  If there is interest in HTMLoop I will clean it up and put it on
  RAA.



  3. When I originally wrote HTMLoop for CLOS under Scheme, everything
  remained an object until final output.

  When I had a brief fling with Python (lasted about a week), I noticed
  that in its HTML lib all objects were formatted as strings as soon
  as they are added to any other object.

  I can see advantages to both methods: If object are formatted as
  soon as they are put to another object, you can use the same objects
  repeatedly (with something like Object.flush in between uses), using
  less memory and so forth.

  Other the other hand it would also mean that objects could only be packed
  after all changes had been made - this is not really a big deal.
  
  A little more sticky is that it would become somewhat more complex
  to tell when to CGI.escapeHTML something.

  If you were using an HTML lib, which method would you prefer?




  My apologies for the length of this post.

  -Dave

--
David Tillman                      |  System Administrator
dtillman / ozarkaircraftsystems.com  |  Ozark Aircraft Systems