From: Erik V. <eri...@xs...> - 2012-07-08 22:12:07
|
Stefan, This all looks pretty good to me. > I consider the java.util.Observable/Observer implementation is not a perfect > fit for Rails, I preferred to write my own instead. > However the Observer interface could potentially change, as I am stil working > on the needs and constraints of the existing GUI. Wouldn't it be better to use different class/interface names, to avoid confusion with the standard Java names Observable and Observer? Not that I have any good proposals. Publisher/Subscriber aren't wrong but sound a bit pompously here. Perhaps ObservableItem and ObservingItem or ObservingElement? > Currently an Observer only provides an update(Observable obs, String > text) method. The latter argument provides a text update for the standard > cases. Did you consider the cases where currently a ViewObject is passed? This can (in theory) contain anything that can be serialized (currently to a String only). > I am wondering if I should add a proxy approach, such that the Observer can > specify a function which has to be called that can be specific for each > Observable observed. Or if I should be more restrictive and allow each > Observer to observe ONLY one observable, thus dropping the need to > specify the Observable in the interface method. Not sure what you mean here. Erik. |