Soft Assertions
I would like to introduce a programming concept which I shall call soft assertions. A soft assertion is an an assertion error that allows the user to try to proceed with the current operation, rather than simply unravelling the stack and exiting the thread.
For example, let's say you SoftAssertion.assert(gummibears.length < 2). Instead of throwing an AssertionException, this method would prompt the user if they want to risk continuing with the current operation. If yes, #assert does nothing. If no (the safer choice), then and only then is the AssertionException thrown.
The SoftAssertion lets power users at least continue on in the face of programming errors. Imagine if you had an assertion exception preventing you from using the Save feature? Frustration!
For example, let's say you SoftAssertion.assert(gummibears.length < 2). Instead of throwing an AssertionException, this method would prompt the user if they want to risk continuing with the current operation. If yes, #assert does nothing. If no (the safer choice), then and only then is the AssertionException thrown.
The SoftAssertion lets power users at least continue on in the face of programming errors. Imagine if you had an assertion exception preventing you from using the Save feature? Frustration!
0 Comments:
Post a Comment
<< Home