3 ms·
I had trouble following along because I couldn't get over how backwards the code is. Why should a book object have the responsibility of adding itself to a cart
by guelo 11y ago
I had trouble following along because I couldn't get over how backwards the code is. Why should a book object have the responsibility of adding itself to a cart? Instead of calling
book.add_to_cart(cart)
It should be
cart.add(book)
- wvenable 11y agoI think it ruins the whole argument. It is not an argument against inheritance but an argument against bad coupling masquerading as an argument against inheritance.