Fakultas Ilmu Komputer UI

Skip to content
Snippets Groups Projects
Commit dc093eed authored by vissutagunawan's avatar vissutagunawan
Browse files

Added Reflection 3 to README.md

parent bd96542d
No related branches found
No related tags found
No related merge requests found
...@@ -65,11 +65,11 @@ You can install Postman via this website: https://www.postman.com/downloads/ ...@@ -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] Commit: `Implement unsubscribe function in Notification controller.`
- [x] Write answers of your learning module's "Reflection Publisher-2" questions in this README. - [x] Write answers of your learning module's "Reflection Publisher-2" questions in this README.
- **STAGE 3: Implement notification mechanism** - **STAGE 3: Implement notification mechanism**
- [ ] Commit: `Implement update method in Subscriber model to send notification HTTP requests.` - [x] Commit: `Implement update method in Subscriber model to send notification HTTP requests.`
- [ ] Commit: `Implement notify function in Notification service to notify each Subscriber.` - [x] Commit: `Implement notify function in Notification service to notify each Subscriber.`
- [ ] Commit: `Implement publish function in Program service and Program controller.` - [x] Commit: `Implement publish function in Program service and Program controller.`
- [ ] Commit: `Edit Product service methods to call notify after create/delete.` - [x] 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] Write answers of your learning module's "Reflection Publisher-3" questions in this README.
## Your Reflections ## Your Reflections
This is the place for you to write 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 ...@@ -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. 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 #### 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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment