From 25169cd367e27a5277ba38d3a8493eb8de2ac075 Mon Sep 17 00:00:00 2001
From: Christian Raphael Heryanto <christian.raphael@ui.ac.id>
Date: Fri, 28 Mar 2025 00:39:30 +0800
Subject: [PATCH] Reflection Publisher-1

---
 README.md | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/README.md b/README.md
index 3043f06..d7bb31b 100644
--- a/README.md
+++ b/README.md
@@ -78,6 +78,26 @@ This is the place for you to write reflections:
 
 #### Reflection Publisher-1
 
+##### Interface vs Struct in Observer Pattern
+
+According to the Head First Design Patterns' description on Observer pattern, the observer (which in this case, `Subscriber`) is defined as an interface. However, in our implementation of Bambangshop, `Subscriber` is defined as a concrete struct rather than a trait.
+
+The need to use trait depends on our requirements:
+
+- **Struct** - This implementation works well if the subscribers are designed to have the same behaviour and properties.
+
+- **Trait** - This implementation works well if several types subscriber are made and each have different implementations.
+
+Bambangshop's notification system is rather simple, all subscribers have a URL which acts as a media for them to receive notifications through HTTP requests. Therefore, the use of a singgle struct is considered sufficient.
+
+##### Vec vs DashMap for Storing Subscribers
+
+Bambangshop implementation's uses `DashMap` to store subscribers with their URLs as keys. It's possible to utilize `Vec` instead of `DashMap`, however it adds more work as we need to ensure the URLs are unique before storing it into the `Vec`. `DashMap`, like other dictionaries, enforce uniqueness, and the keys of DashMap required to be unique. In conclusion, it's possible to use Vec, however it's best to use DashMap.
+
+##### Thread Safety with DashMap vs Singleton Pattern
+This implementation utilizes both DashMap and Singleton pattern (lazy_static). Both plays an important role in this case, where DashMap allows thread-safe, optimal performance, access to the database and the singleton pattern allows the creation of an instance only when it's requested.
+
+
 #### Reflection Publisher-2
 
 #### Reflection Publisher-3
-- 
GitLab