From: Panagiotis Atmatzidis Date: 2012-01-25T23:53:12+09:00 Subject: A sort of design question Dear Ladies (??) and Gentlemen (okay we have plenty of those), I wrote a script which needs a variable in order to proceed. This variable is defined by the user otherwise the default location is chosen. After a discussion I had on IRC (#ruby @ Freenode), I came up with a few questions. My script is structured like this: class [...] optparse [...] execution_flow_control [...] I do the 'control' of this variable inside the class like this: class Prog attr_accessor :database def initialize(database) @database = database end [...] def create_table(tableid) if @database and File.exists?(@database) <--- control [...] end I was wondering if this is the right way actually do this control since, if @database is not set, the flow will never reach that point, because the class takes 1 argument (which is @database) and if it's null, it will come up with an error. The script works fine, as is. I optimized it a bit, by removing and/or optimizing some functions. But I'm curious, where is the right place for doing this control which is necessary for execution? Best Regards, ps. Here is the entire script: https://github.com/atmosx/morula/blob/master/morula Panagiotis Atmatzidis ----------------------------- Pharmacy Student at VFU, Brno mailing lists: ml@convalesco.org personal info: http://www.convalesco.org The wise man said: "Never argue with an idiot, he brings you down to his level and beat you with experience."