Use immutability or defensive copying to prevent accidental modifications.
Immutability ensures an object's state cannot change after creation, while defensive copying creates a new instance when sharing data. In a store model, making Product immutable prevents price changes affecting all CartItems referencing it.
Additional Notes
How do you ensure shared objects are not accidentally modified?