From ad9208beffe8dae38cde1252e9fdeed6ed68c67b Mon Sep 17 00:00:00 2001 From: rafliesa <rflisaa@gmail.com> Date: Fri, 28 Mar 2025 13:56:25 +0700 Subject: [PATCH] Reflection Publisher-3 --- README.md | 10 ++++++++++ src/service/product.rs | 3 +-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 1677c91..9a80fcd 100644 --- a/README.md +++ b/README.md @@ -18,3 +18,13 @@ Model menjadi sangat bloated. Selain itu, skalabilitas menjadi sangat buruk, mis ## 3. Have you explored more about Postman? Tell us how this tool helps you to test your current work. You might want to also list which features in Postman you are interested in or feel like it is helpful to help your Group Project or any of your future software engineering projects. Postman membantu kita untuk mengetest endpoint yang telah kita buat. Alih-alih memerlukan browser client seperti metode konvensional. Kita dapat menembak langsung ke endpoint dengan berbagai request method tanpa perlu berinteraksi melalui client. Hal ini sangat membantu kita dalam mengembangkan sisi backend dari sebuah aplikasi. + +# 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? +Kita menggunakan Push model pada projek ini, terlihat bahwa notifier tidak hanya menotify subscriber tetapi juga melakukan update langsung. + +## 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) +Jika kita menggunakan Pull model pada tutorial ini, keuntungannya adalah observer dapat memutuskan sendiri berapa data yang diperlukan. Sedangkan kekurangannya adalah meningkatkan kompleksitas karena tiap observer harus melakukan fetch data sendiri-sendiri. + +## 3.Explain what will happen to the program if we decide to not use multi-threading in the notification process. +Observer akan memiliki delay pada penerimaan notifikasi karena perlu menunggu pengiriman notifikasi untuk observer lain akan selesai. Bayangkan jika ada jutaan observer, maka proses akan menjadi sangat lama. \ No newline at end of file diff --git a/src/service/product.rs b/src/service/product.rs index 1b05963..8b1f125 100644 --- a/src/service/product.rs +++ b/src/service/product.rs @@ -3,12 +3,11 @@ use rocket::serde::json::Json; use bambangshop::{Result, compose_error_response}; use crate::controller::product; +use crate::model::notification::Notification; use crate::model::product::Product; use crate::repository::product::ProductRepository; use crate::service::notification::NotificationService; - - pub struct ProductService; impl ProductService { -- GitLab