From eb36381929ab28087c1f4f77b090621fe36ccf75 Mon Sep 17 00:00:00 2001
From: Scallss <pascalhafidz2005@gmail.com>
Date: Fri, 28 Mar 2025 18:23:29 +0700
Subject: [PATCH] updated readme for Reflection Subscriber-2

---
 README.md | 38 +++++++++++++++++++++++++++-----------
 1 file changed, 27 insertions(+), 11 deletions(-)

diff --git a/README.md b/README.md
index cf39d3c..56a0247 100644
--- a/README.md
+++ b/README.md
@@ -68,16 +68,16 @@ You can install Postman via this website: https://www.postman.com/downloads/
     -   [x] Commit: `Implement list_all_as_string function in Notification repository.`
     -   [x] Write answers of your learning module's "Reflection Subscriber-1" questions in this README.
 -   **STAGE 3: Implement services and controllers**
-    -   [ ] Commit: `Create Notification service struct skeleton.`
-    -   [ ] Commit: `Implement subscribe function in Notification service.`
-    -   [ ] Commit: `Implement subscribe function in Notification controller.`
-    -   [ ] Commit: `Implement unsubscribe function in Notification service.`
-    -   [ ] Commit: `Implement unsubscribe function in Notification controller.`
-    -   [ ] Commit: `Implement receive_notification function in Notification service.`
-    -   [ ] Commit: `Implement receive function in Notification controller.`
-    -   [ ] Commit: `Implement list_messages function in Notification service.`
-    -   [ ] Commit: `Implement list function in Notification controller.`
-    -   [ ] Write answers of your learning module's "Reflection Subscriber-2" questions in this README.
+    -   [x] Commit: `Create Notification service struct skeleton.`
+    -   [x] Commit: `Implement subscribe function in Notification service.`
+    -   [x] Commit: `Implement subscribe function in Notification controller.`
+    -   [x] Commit: `Implement unsubscribe function in Notification service.`
+    -   [x] Commit: `Implement unsubscribe function in Notification controller.`
+    -   [x] Commit: `Implement receive_notification function in Notification service.`
+    -   [x] Commit: `Implement receive function in Notification controller.`
+    -   [x] Commit: `Implement list_messages function in Notification service.`
+    -   [x] Commit: `Implement list function in Notification controller.`
+    -   [x] Write answers of your learning module's "Reflection Subscriber-2" questions in this README.
 
 ## Your Reflections
 This is the place for you to write reflections:
@@ -96,6 +96,22 @@ This is the place for you to write reflections:
     In Rust, static variables are immutable by default, and even when declared as mutable, they require synchronization mechanisms like `RwLock<>` or `Mutex<>` to ensure thread safety. This design is based on Rust's emphasis on safety and preventing data races in concurrent programming.
 
     Unlike Java, where static variables can be mutated without any inherent thread-safety guarantees, Rust enforces strict ownership and borrowing rules. This ensure that mutable access to shared data is always synchronized, preventing undefined behavior and ensuring memory safety. Rust makes it clear when and how shared data is being accessed or modified, leading to safer and more predictable code.
-    
+
 
 #### Reflection Subscriber-2
+1. **Exploration Outside Tutorial**
+
+    Yes, I explored `src/lib.rs` and other parts of the code. From `src/lib.rs`, I learned how the modules are structured and how the project is organized using the `mod` keyword to include submodules. This helped me understand the overall architecture of the project and how different components interact with each other. It also gave me insights into how Rust enforces modularity and encapsulation.
+
+
+2. **Multiple instance of Receiver and Main in Observer Pattern**
+
+    The Observer pattern simplifies adding more subscribers because each subscriber can independently register itself to receive notifications without modifying the core notification system. This decoupling ensures that the system remains flexible and scalable. Spawning multiple instances of the Receiver app works seamlessly because each instance acts as an independent subscriber.
+
+    However, spawning more than one instance of the Main app is a different case and might introduce different challanges, such as ensuring consistent state across instances or avoiding duplicate notifications. Which would require additional mechanisms like a shared database or a message broker to synchronize state and manage communication between instances.
+
+
+3. **Additional tests and documentation in postman Collection.**
+
+    Yes, I have created more tests to validate the functionality of the notification system. Writing tests helped me identify edge cases and ensure that the system behaves as expected under different scenarios. Even though the process is a bit intricate by coming up with different cases, it definitely will help with development and maintenance in the long run.
+
-- 
GitLab