A new feature that edits four working classes
transcript
Operations wants the shipping weight of a cart. The cart has four kinds of item, and every one of them already works.
In the first version, each class has its own methods. So weight goes into the grocery. And the gadget. And the book, and the bundle. Four classes, all working today. All of them need a test again.
Four working files change, and three teams collide in them. Each needs a review. Or one new class. A weight visitor, and no item opened.
The visitor has one method for each kind of item. Each item just calls the one for its own kind. So a new operation is a new visitor. Nothing else moves.
Zero item classes edited. One new class. And 2,500 grams for the cart.
The items know nothing about weight. They only say, visit me. That's why operations can be added from outside.
Full breakdown in the lecture.