Is the a pattern for iterating over lists held by a class (dynamicly typed OO languages)
- by Roman A. Taycher
If I have a class that holds one or several lists is it better to allow other classes to fetch those lists(with a getter) or to implement a doXList/eachXList type method for that list that take a function and call that function on each element of the list contained by that object. I wrote a program that did a ton of this and I hated passing around all these lists sometimes with method in class a calling method in class B to return lists contained in class C, B contains a C or multiple C's
(note question is about dynamically typed OO languages languages like ruby or smalltalk)
ex. (that came up in my program) on a Person class containing scheduling preferences and a scheduler class needing to access them.