From: thomas coopman Date: 2006-06-19T23:39:12+09:00 Subject: Re: best way to deal with command line options On Mon, 19 Jun 2006 22:50:09 +0900 Matthew Smillie wrote: > > If there's more than one place, then you want to make it one place. > One way of doing this is using a logger: the class would *always* > tell the logger what's going on, and the logger worries about the > verbose parameter and whether or not to tell you. Sort of like this: > > The Logger class in Ruby's stdlib does exactly this, but in a > significantly more sophisticated way. > That's a good idea, I will look into that or else write my own simple logger class > a) and b) are the same thing, it's just the location of the 'run' > method that's different, so the question boils down to "where's the > appropraite place to have my 'run' method?" Which is actually quite > difficult to answer without knowing anything about the code. Do you > think that the 'run' method is integral to the A class? Or is it > more of a user-interface thing that should be separate from A? Both > approaches could be justified. > > matthew smillie. > > > It's indeed a question about where to put the run method, it should probably be placed in the class itself and not in the main. Another little question, what's the best way to do when writing a program in ruby, keep the core and the main in different files, place them in the same file,.. or doesn't it matter? Thanks, Thomas Coopman