Failure atomicity

A class can be left in a broken state if it throws a runtime exception. Immutability prevents this problem. An object will never be left in a broken state because its state is modified only during its initialization. The initialization will either fail, rejecting object initialization, or succeed, making a valid solid object, which never changes its encapsulated state.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset