On Wed, 20 Dec 2000, Guy N. Hurst wrote: > I had to have some extra excuse for departing from the 1 month=30 day > formula in order to use the handy Time class ;-) Help yourself! The original code suuuucked! :) > And I personally think that the arrangement I discovered stands out, > which is why I bothered to post it. I also think that the other > approaches people have posted represent some nice inventions, > especially your assortment :-) Yes, I have no idea how some of the presented code works at all, but it's great to know exactly what the code is doing. It's given me a whole new range of things to look at so it's been good. :) > In doing that I did look for a way to avoid using divmod or the table > or scattered logic. And I found a way. Also, no one else put their code > into a class. Yes, that was good! I'm not an OO programmer, so I wanted to see what the code would look like in OO shape, and any advantages/benefits of doing things that way. > Wouldn't you agree that, since functions are not first class objects in > Ruby, that it makes more sense to focus on the objects? I think this > is what Steve was getting at (Steve?). To do this it seems that I > should minimize parameters and put the methods inside appropriate > classes with a carefully selected name. Yep! > So, perhaps this is a conversation *starter* ? :-) Hopefully this code dissection, rewriting and optimisation becomes a regular feature. Anyone else want to post the next amusing problem for us to work on? :) -- steve / deaf.org