BulletproofFoo
Initializing a usable object in the constructor has the tremendous virtue of enabling guaranteeing that an object will only be instantiated into a good state (illegal states detected and exceptions thrown in the constructor implementations). From that point on the object can jealously guard the validity of its state, throwing on methods with illegal arguments that would compromise its state.
Where possible, make your Foos bulletproof.
0 Comments:
Post a Comment
<< Home