Use constructor and setter validations to enforce rules.
To keep an object in a valid state, implement checks in constructors and setters to enforce rules. For instance, a constructor in a Product class should ensure price is non-negative, and setters should validate any changes.
Additional Notes
How do you ensure an object’s state is always valid?