According to Bertrand MEYER's design by contract practice (implemented into Eiffel), we specify class responsibilities in terms of pre-conditions and post-conditions. These conditions are evaluated in assertions.
Class invariants are also checked by assertions.
Combined with a test-driven practice, this is a great way to implement the stop-the-line culture. Furthermore, it a great way to build mistake-proof code, as a class instance may not be used without respecting its operations pre-conditions.

Aucun commentaire:
Enregistrer un commentaire