Encapsulation
Protecting code against invariant violations by making the wrong thing impossible.
Encapsulation is the act of protecting code against invariant violations and a key component of a Well-Designed API.
"You cannot trust yourself to do the right thing all the time—so, eliminate the very possibility of doing the wrong thing."
Khorikov (2020) (pg. 104)
References
Vladimir Khorikov. Unit Testing: Principles, Practices, and Patterns. Manning, Shelter Island, NY, 2020. ISBN 978-1-61729-627-7. ↩