When I was at my brief stint at Hypnotix, the programming owner there, who was the world’s biggest jackass, once called me “Assert Boy.” This was due to my habit of putting asserts all over my code – on a few occassions too many but mostly valid. So, when other programmers ran my code they’d sometimes hit asserts, which felt like a crash, and to a simpleminded observer (such as the programming owner), my code crashed a lot.

In fact, the only difference was that my code stopped early, where the problem was easy to fix, as opposed to late, someplace random in code, where the problem is very hard to fix.

In my opinion asserts are one of the most valuable debugging tools and should be used judiciously.

Average Rating: 4.5 out of 5 based on 261 user reviews.

Leave a Reply