Steve Litt wrote:
> On Wednesday 07 December 2005 09:13 pm, Steve Litt wrote:
> > Hi all,
> >
> > I wrote some hierarchy handling classes in Node.rb
> > (http://www.troubleshooters.com/projects/Node.rb/index.htm), and I've been
> > told I write Ruby in Perl style. In future software, what could I do to
> > write in a more Ruby-like fashion?
> >
> > Thanks
> >
> > SteveT
>
> Whoops, the actual code is here:
> http://www.troubleshooters.com/projects/Node.rb/downloads/0.02/Node.rb, with
> test progarm here:
> http://www.troubleshooters.com/projects/Node.rb/downloads/0.02/testnode_parse.rb
> and test data here:
> http://www.troubleshooters.com/projects/Node.rb/downloads/0.02/test.otl
>
> /testnode_parse < test.otl | less
>
> Thanks
>
> SteveT
>
> Steve Litt
> http://www.troubleshooters.com
> slitt / troubleshooters.com

Hi Steve,

Here are some quick pointers:

* No need to subclass Object.  All classes inherit from Object
automatically
* You don't need most of the explict getters and setters.  That's what
attr_accessor is for
* Ditch the camel case
* No need for semicolons
* Rather than method names like "setParent", use "parent=".

Regards,

Dan