Quantcast
Channel: Crafting software» mrdavidlaing
Viewing all articles
Browse latest Browse all 13

A Defect Exception

$
0
0

Occasionally one comes across a idea that is just brilliant.

How often have you been writing a bit of code, and got to a point where you think “gee, if the program ever gets into this state, then something is really wrong”. Throwing an exception seems appropriate, but what kind of exception to throw?

Enter the following sage advise from Steve Freeman and Nat Pryce in their great book “Growing Object Orientated Software Guided by Tests”:

Growing Object Orientated Software Guided By Tests - pg165

Growing Object Orientated Software Guided By Tests - pg165

A DefectException(). What a simple but brilliant idea!

Thanks guys


Viewing all articles
Browse latest Browse all 13

Trending Articles