December 2018
Intermediate to advanced
414 pages
10h 19m
English
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.
Read now
Unlock full access