Five objects to compare two strings
transcript
You want to test one delivery fee. Same city, 20 rupees. Different city, 45.
First, build an order. Then a customer, and a restaurant. And two addresses. Five objects, to compare two strings. The rule only needs to know: same city, or not?
The fee rule reaches through the order. Then the customer. Then the address. Then the city. It knows the shape of the whole graph. Don't talk to strangers.
Here's the catch. Split city into area and city. The fee rule breaks. In a file the change never mentioned. Every function that wrote address dot city has to change.
The customer answers for its city. The restaurant answers for its city. The fee rule takes two things that have a city. A test needs two stubs.
Put each question with the data's owner. Pass what the rule needs, not the whole graph. Fewer things to know, fewer things to break.
Full breakdown in the lecture.