On Nov 15, 2006, at 12:35 PM, Jamie Macey wrote: > On 11/15/06, James Edward Gray II <james / grayproductions.net> wrote: >> In fact, Program could be as simple as: >> >> Program = Struct.new(:start_time, :end_time, :channel, :days) > > I think that there's a trade-off here. If you have a stupid (no > internal logic) Program class, you can trade a very simple add method > for a more complicated record? method. > > My position on it is that if I'm going to be leaving the brunt of the > logic in the ProgramManager, I don't think there's a huge difference > between nested arrays, a struct, or a class being the holder of the > data. Good point. > That being said, on a lark I did a bit of refactoring and tried to > move as much logic out of the ProgramManager into an actual Program > class - the results are below. > > I definitely prefer the second version. It's got 10 more lines of > actual code, but there's less random logic strewn about (and the logic > is simpler). There's a definite separation of responsibilities - > Program just does querying, ProgramManager handles priorities. You just learned what I also learned today, writing the summary. ;) James Edward Gray II