MAKE INVALID STATES UNREPRESENTABLE
Invalid states can lead to runtime errors and less reliable code. However, by shrinking the gap between representable, valid states, errors can be moved from runtime to compile time, which allows them to get caught much earlier. Type systems can and should be used to model business logic that makes invalid states impossible and unrepresentable. This article goes through a few examples, such as a “Color” type that prevents invalid colors.