in reply to How do "you" make a tree in perl
Anyhow, on the topic of "what do I do", while nested hashes are ok for serialization, they are too unsafe due to the possiblity of coding errors (I prefer syntax errors to runtime errors), so I'll usually do something specialized and optomzied to the task. This probably involves having some objects behave as Nodes, which is where we need mixins (subclassing Node is wrong!) ... which is not really covered cleanly in Perl 5.x
I also abhor the design pattern FAD so I avoid things such as VisitorFactories, as I get this silly image of a factory with Tourists popping out of the loading dock -- that's not what OO is supposed to be about. I think you've got a Forrest::Complex there instead of a Tree::Simple. No reason to rant against Tree::DAG_Node about line count (line count wars are always petty) in your POD when you have a design such as this requiring so many modules for a "Tree::Simple" class.
(edited slightly to tone down design pattern rant)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: How do "you" make a tree in perl
by stvn (Monsignor) on Sep 29, 2004 at 16:15 UTC | |
by SpanishInquisition (Pilgrim) on Sep 29, 2004 at 17:47 UTC | |
by stvn (Monsignor) on Sep 29, 2004 at 18:03 UTC | |
by SpanishInquisition (Pilgrim) on Sep 29, 2004 at 18:18 UTC |