diff --git a/README.md b/README.md index 1677c91c75e4ee5a4bc26c030aa54daa7fc94e9d..9a80fcd515801d22f1663a464619130cdae42f45 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 1b059637abcbeb32f7551b48bd5305e1c27a3de9..8b1f125131837776a436e0fc59ad293701b43168 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 {