On 8/8/11 11:52 AM, Sébastien Brisard wrote: > Hi, > a useful feature for *any* iterative algorithm would be the > possibility to call a "monitor" at the end of each iteration. What > would this monitor do would pretty much depend on the user's mood: > periodically backup the state of the algorithm (in order to restart it > in case of a crash), log a set of tabulated values (to plot the > convergence of the algorithm), ... > The idea would be to come up with a design as general as possible. > Gilles proposed (see MATH-581) to use java.util.Observable. This > sounds very attractive to me. Any comments?
+1 to the idea of using the Observer pattern; but -0 for Observable. I would favor defining Events and Listeners because a) Observable is concrete, so effectively forces you to create an Observable delegate and b) the interface is crude and is really designed for GUI scenarios where observers are holding references to the Observable and just being notified that something has changed. Events are more flexible and can be implemented using interfaces. Has anyone ever actually used Observable outside of a GUI m/v environment? Does anyone know of event frameworks suitable for monitoring long-running computations that we might adapt? In any case, I think it is a good idea to develop an event framework for [math]. We should probably also think about doing this in a way that is at least JMX-friendly. Phil > Best regards, > Sebastien > > --------------------------------------------------------------------- > To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org > For additional commands, e-mail: dev-h...@commons.apache.org > > --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org For additional commands, e-mail: dev-h...@commons.apache.org