Observer Pattern likes relation subscribe and publish that define a one to many dependency, if one change the states that all dependency could changed the srates automatic.
For example there is a Service that provide some subscribe and publish services, and you can subscribe one or more of these services.
Each one make a subscriber, the service will publish the service to you.
The simple Observer Pattern is
The one to many dependency when the states of ObseverServer changed , all of Obsever will update.
In the java there are the java.util.Observable and java.util.Obsever to implement the Obsever Pattern.
there is no example in the project,so just write some concept.
For example there is a Service that provide some subscribe and publish services, and you can subscribe one or more of these services.
Each one make a subscriber, the service will publish the service to you.
The simple Observer Pattern is
interface ObseverServer {
void addObserver(Observer observer);
void removeObserver(Observer observer);
void notifyChanges();
}
interface Obsever() {
void update();
}
The one to many dependency when the states of ObseverServer changed , all of Obsever will update.
In the java there are the java.util.Observable and java.util.Obsever to implement the Obsever Pattern.
there is no example in the project,so just write some concept.