James B. Byrne wrote: > I have written my first live ruby script that actually performs useful > work as an exercise in syntax discovery. It is very much a straight > line utility that could just as easily be written in bash. What I would > like is for someone to look at the code reproduced below and guide me > through the steps to convert this into something approximating the ruby > OOP idiom. I come from a 4GL universe working on mid-range and high end > iron and OS rather than unix/linux and OOP. So, I have a major > challenge getting my head out of first gear. > > Looking at this I wondered what can be placed into separate classes. It > seems to me that the check for environment variables and defaluts and > then creating the resulting directory strings and regexp objects is > either one functional group or two, depending if one considers the > search for environmental settings totally separate from the directory > validation process or not. I tend to see two classes; GetDirs and > CheckDirs. Another class would likely be MoveFiles. James, Try reading the RubyGarden wiki page WhatIsAnObject[0] and Allen Holub's "Why Getter and Setter Methods are Evil" article and you should have a better idea of what OO is supposed to look and feel like. * And I just found "Tell, Don't Ask"[2] by the Pragmatic Programmers, which helps me better understand OO design. HTH, -dave * Both links were recently posted in other threads, and I learned a lot from them. Thanks! :) [0] http://www.rubygarden.org/ruby/ruby?WhatIsAnObject [1] http://www.javaworld.com/javaworld/jw-09-2003/jw-0905-toolbox.html [2] http://www.pragmaticprogrammer.com/ppllc/papers/1998_05.html