From: flebber Date: 2010-11-18T20:15:15+09:00 Subject: Re: Ruby Not observing DRY principle On Nov 18, 10:00 pm, Arturo Garcia wrote: > On Thursday 18 November 2010 10:40:24 flebber wrote:> On Nov 18, 9:22 pm, Shadowfirebird wrote: > > > Any ideas appreciated. I just need to understand how to get the flow > > better. I notice that if I am thinking something is to hard in Ruby > > then I am probably doing it the wrong way. Each tie I do my program I > > get better structure just concerned if I am missing the OO point > > overall..... > > I don't really understand what you're trying to do there, but I think you > need: > > - An event handler (to intercept user input) > - Blocks to handle each of your events > - The process itself (a class representing what the program does) > ** And, if the user is calling algorithms, then each algorithm belongs to it's > own class/function.  How you call them is a matter of taste (I would push a > hash with algorithm parameters). > > I think you need to get your ideas right, then apply ruby and its sugar. > > Good luck! To me thats where I am tripping up, in my program I define a function but don't seem to need a class or would it be simply that my function I am calling is my class. Really interested to now what type of case statement or for each satement you would use with a block like below. ??? Should I be using a foreach case statement here or am I someway missing the ??? the point of object oriented language? ??? Should it be option1.foo, option2.foo etc option1 foo(set of variables, user input 1) # set of variables will be different for each option # Sets will have same variable types but different values option 2 foo(set of variables, user input 1) foo(set of variables, user input 2) option 3 foo(set of variables, user input 1) foo(set of variables, user input 2) option 4 foo(set of variables, user input 1) foo(set of variables, user input 2) # If result of both tests in an option proves true then output options.