This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Rahul, I think Michael assumed that the 100 objects already were created, i.e. you shouldn't create the object before you call the method.
Michal, try to perform much like the one Rahul made.
for 1..100 do list[i].perform()
for 1..100 do obj.perform()
and compare the result.
From a performance point of view, creating a single object instead of creating 100 object is obviously to be prefeered (memory) in the general case, however im sure there are arguments for creating 100 objects instead of having one single object performing 100 jobs. [ September 27, 2006: Message edited by: Svend Rost ]
I don't think that there will be signicicant difference (the method will run 100 times in both cases).
Joined: Sep 25, 2006
Hi all, first, thank you for your efforts to help me! Svend was right. The object creation itself is no problem... just the function calls. But the hint about the moemory usage was good. I didn�t think of that.... that can become a problem(sooner or later). It looks like that i have to tryout all the possibilities.