From dc093eed2585e304dfae792cd7a5d7576e2248d6 Mon Sep 17 00:00:00 2001
From: vissutagunawan <vglim3653@gmail.com>
Date: Thu, 27 Mar 2025 09:50:54 +0700
Subject: [PATCH] Added Reflection 3 to README.md

---
 README.md | 37 ++++++++++++++++++++++++++++++++-----
 1 file changed, 32 insertions(+), 5 deletions(-)

diff --git a/README.md b/README.md
index c12af24..bce6fdf 100644
--- a/README.md
+++ b/README.md
@@ -65,11 +65,11 @@ You can install Postman via this website: https://www.postman.com/downloads/
     -   [x] Commit: `Implement unsubscribe function in Notification controller.`
     -   [x] Write answers of your learning module's "Reflection Publisher-2" questions in this README.
 -   **STAGE 3: Implement notification mechanism**
-    -   [ ] Commit: `Implement update method in Subscriber model to send notification HTTP requests.`
-    -   [ ] Commit: `Implement notify function in Notification service to notify each Subscriber.`
-    -   [ ] Commit: `Implement publish function in Program service and Program controller.`
-    -   [ ] Commit: `Edit Product service methods to call notify after create/delete.`
-    -   [ ] Write answers of your learning module's "Reflection Publisher-3" questions in this README.
+    -   [x] Commit: `Implement update method in Subscriber model to send notification HTTP requests.`
+    -   [x] Commit: `Implement notify function in Notification service to notify each Subscriber.`
+    -   [x] Commit: `Implement publish function in Program service and Program controller.`
+    -   [x] Commit: `Edit Product service methods to call notify after create/delete.`
+    -   [x] Write answers of your learning module's "Reflection Publisher-3" questions in this README.
 
 ## Your Reflections
 This is the place for you to write reflections:
@@ -108,3 +108,30 @@ Using only the Model to handle both data storage and business logic would create
 Postman is an invaluable tool for testing web endpoints through HTTP requests. It allows for rapid testing of web application functionality without writing additional code. Some of the most useful features include the ability to save requests and responses for future reference, simple control over request headers and body content, and effective cookie management. Postman also offers excellent API documentation capabilities, making it easier to share endpoint information with other developers. This tool has been tremendously helpful for testing our web application endpoints, and I plan to continue using it in future software engineering projects as it streamlines the API testing process significantly.
 
 #### Reflection Publisher-3
+
+> 1. Observer Pattern has two variations: Push model (publisher pushes data to subscribers) and Pull model (subscribers pull data from publisher). In this tutorial case, which variation of Observer Pattern that we use?
+
+In this tutorial, we implemented the push model of the Observer pattern. With this approach, the publisher actively distributes notifications to subscribers without them having to request it. This is clearly demonstrated in the Notification service's notify function, where the publisher takes responsibility for sending notifications directly to all registered subscribers rather than waiting for them to request updates.
+
+> 2. What are the advantages and disadvantages of using the other variation of Observer Pattern for this tutorial case? (example: if you answer Q1 with Push, then imagine if we used Pull)
+
+If we had used the pull model instead, there would be several trade-offs:
+Advantages of pull model:
+
+- Simpler overall codebase structure with reduced observable complexity
+- Subscribers gain more control by choosing which specific data to retrieve
+- Subscribers can determine their own timing for data retrieval based on their needs
+
+Disadvantages of pull model:
+
+- Requires subscribers to periodically check for updates, potentially leading to high CPU usage
+- Can introduce significant latency as subscribers might not immediately detect changes
+- Less efficient overall compared to push model, where notifications are delivered promptly
+- May create unnecessary polling traffic when no updates are available
+
+The push method we used offers better efficiency and lower latency since subscribers receive notifications immediately without having to continuously check for updates.
+
+> 3. Explain what will happen to the program if we decide to not use multi-threading in the notification process.
+
+Without multi-threading in our notification system, the program would experience blocking behavior during notification delivery. The main process would halt while waiting for each notification to be completely delivered to a subscriber before proceeding to the next one or continuing with other operations. This would significantly reduce efficiency and increase latency throughout the application.
+This problem would become exponentially worse as the subscriber base grows, since the system would need to wait for each sequential notification to complete before moving on. The result would be poor scalability, with performance degrading sharply as more subscribers join the system. Multi-threading is therefore essential for maintaining responsiveness and scalability in our observer pattern implementation.
\ No newline at end of file
-- 
GitLab