Skip to content

Latest commit

 

History

History
18 lines (13 loc) · 1.61 KB

File metadata and controls

18 lines (13 loc) · 1.61 KB

Observer Design Pattern

This repository accompanies the article on A Brief Introduction to Observer Pattern, providing insights into the Observer design pattern, its applications, and a practical code example. The main focus is on understanding the concept and implementing it in the context of a simple web page, specifically a profile page in an application.

Overview

The Observer pattern is a powerful software design pattern where an object, known as the subject, maintains a list of its dependents, called observers. The subject automatically notifies observers of any state changes, typically by invoking one of their methods. This pattern establishes a one-to-many dependency relationship, making it ideal for scenarios with numerous components dependent on specific events.

Use Case - Profile Page

The practical demonstration involves the creation of a simple web page, representing the profile page of an application. Users can load an image on this page, and upon successful loading, the image is displayed in two locations: the navbar and the profile page.

Running the Application

To run the application locally, follow these steps:

  1. Clone the repository: git clone [repository-url]
  2. Navigate to the project folder: cd [project-folder]
  3. Open file profile.html

Feel free to explore the code and use it as a reference while reading the article to gain a deeper understanding of the Observer pattern in action.

Happy coding! 🚀