This repository contains implementations of the Observer design pattern in various programming languages. The Observer pattern defines a one-to-many dependency between objects so that when one object changes state, all its dependents are notified and updated automatically.
- Represents a channel that subscribers can subscribe to.
- Methods:
Subscribe(Subscriber sub): Subscribes a subscriber to the channel.UnSubscribe(Subscriber sub): Unsubscribes a subscriber from the channel.NotifySubscriber(): Notifies all subscribers when an upload occurs.Upload(String title): Uploads a new video with the given title.
- Represents an observer that can subscribe to channels.
- Methods:
Update(): Method to be implemented by concrete subscribers to update them about changes.SubscribeChannel(Channel ch): Subscribes the observer to a specific channel.
- Contains the main method for testing the Observer pattern implementation.
- Abstract class representing an observer.
- Methods:
Update(): Virtual method to be overridden by concrete observers.
- Represents a channel that observers can subscribe to.
- Methods:
Subscribe(IObserver* observer): Subscribes an observer to the channel.UnSubscribe(IObserver* observer): Unsubscribes an observer from the channel.NotifyObservers(): Notifies all subscribed observers.Upload(std::string title): Uploads a new video with the given title.
- Represents a subscriber that observes a channel.
- Methods:
Update(): Updates the subscriber about changes in the channel.
- Contains the main function for testing the C++ Observer pattern implementation.
- Represents a channel that subscribers can subscribe to.
- Methods:
Subscribe(Subscriber sub): Subscribes a subscriber to the channel.UnSubscribe(Subscriber sub): Unsubscribes a subscriber from the channel.NotifySubscriber(): Notifies all subscribers when an upload occurs.Upload(String title): Uploads a new video with the given title.
- Represents an observer that can subscribe to channels.
- Methods:
Update(): Method to be implemented by concrete subscribers to update them about changes.SubscribeChannel(Channel ch): Subscribes the observer to a specific channel.
- Represents a subscriber that observes a channel.
- Methods:
Update(): Updates the subscriber about changes in the channel.
- Contains the main method for testing the C# Observer pattern implementation.
Feel free to explore each language-specific implementation for more details and usage examples.