This pattern just passes a collaborator in the method:
class BasketClient {
func add(product: Product, to store: BasketStore) {
store.add(product: product)
calculateAppliedDiscount()
//...
}
// ...
private func calculateAppliedDiscount() {
// ...
}
}
This is useful when the object has several collaborators, but most of them are just temporary and it isn't worth having the relationship set up for the whole life cycle of the object.