Skip to content

Instantly share code, notes, and snippets.

@scottyinternet
Last active May 9, 2023 18:42
Show Gist options
  • Save scottyinternet/196605791aecca246ee60379c7551c57 to your computer and use it in GitHub Desktop.
Save scottyinternet/196605791aecca246ee60379c7551c57 to your computer and use it in GitHub Desktop.

Unit1 PromiseDao Design Review

Overview

The PromiseDao only supports one source for retrieving promises: the Delivery Promise Service (DPS). We already need to get promises from another service, the Order Fulfillment Service (OFS), so this is a good time to make the design more flexible.

Use Cases

  • The CS representatives will be able to compare promises from different services to verify if promises are on track.
  • The CS representatives will be able to confirm broken promises, communicate to customers where order got off track.

Current Design

The PromiseDAO fetches a delivery date for an orderItem from the OrderManipulationAuthority via the OrderManipulationAuthorityClient.

The PromiseDAO fetches a Promise from the DeliveryPromiseService via the DeliveryPromiseServiceClient

deliveringonourpromise_CD

Proposed Solution

Create an Interface for all ServiceClient classes

The Interface methods will include a method to fetch a promise.

Each class implementing the interface will be responsible for fetching the promise from the appropriate service and creating a promise

Out of Scope

This will only fetch Promises. The logic for seeing if Deliveries are on track and comparing Promise delivery dates to find break downs will happen elsewhere.

Details

deliveringonourpromise_ProposedDesign

The PromiseDAO will contain a List of <PromiseClientInterface>

Within the get() method of the PromiseDao, we will iterate over all PromiseClientInterfaces and call getDeliveryPromiseByOrderItemId(customerOrderItemId), which will return each Promise.

Each class implement PromiseClientInterface will contain a getDeliveryPromiseByOrderItemId which will fetch raw promise data from the appropriate service and build a Promise.

This will be "O(n)". The number of PromiseClientInterfaces in the List will be iterated over, fetch raw promise data, build a Promise and add the Promise to a List.

@jsoderkvist
Copy link

jsoderkvist commented May 9, 2023

I'm wondering about "getDeliveryPromiseByOrderItemId" as the interface method name. As I understand it, the Promise returned may not be related to delivery (for example, from OrderFulfullmentService). What do you think about "getPromiseByOrderItemId" as an alternative, since the object returned will be a Promise?

@jsoderkvist
Copy link

By convention, you don't typically see Interface as part of the names of interfaces (e.g., Comparable, Comparator). I don't think it's necessary to change that at this point, though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment