Skip to main content
6 events
when toggle format what by license comment
Apr 1, 2019 at 18:15 comment added stelios.anastasakis i think this pattern focuses on how, many observers can subscribe to one observable. if 1 observable notifies observers calling update(x, y) then an observer can use abstracrion in its 'update' and the other division. Not on how one observer can subscribe with the same method in 2 observables. then u might need 2 implementations of the pattern, with 2 'update' methods etc. But u can even subscribe to 2 subjects, if they are handled similarly, if you pass the proper params in 'update'. So if the latter is the case, u have the pattern and the concepts behind it. Try to use it for your own case
Apr 1, 2019 at 17:47 comment added NingW Since only 1 class Person implements the observer interface(BookReader), it will have only one update() method from this interface, but this person subscribes to two observables, which means this single update() method have to contain two segments of code dealing with two different observables. So wouldn't this be a problem?
Apr 1, 2019 at 16:42 comment added stelios.anastasakis you will have 1 class implemenring observer, Person and 2 implementing observables, BooStore and Library, if i get it right. The person will be injected in constructor a list of observables. This way person subscribes where u want and stays decoupled. Am i missing something on your question?
Apr 1, 2019 at 16:30 review First posts
Apr 1, 2019 at 18:27
Apr 1, 2019 at 12:19 comment added NingW Suppose a Person interested in BookStore's weekly news, and Library's weekly news, so the person will subscribe for both subjects, then if only one interface BookReader, a Person class will contain two unrelated implementation in it, wouldn't this cause any problem?
Apr 1, 2019 at 12:01 history answered stelios.anastasakis CC BY-SA 4.0