Posts on Peter Villano's Website · May 25, 2022
Assert Considered Helpful
0Sign in to vote or save
This page did not load. You can still read it on the original site — the toolbar below keeps your place in the directory.
Last Advent of Code I took to putting assert statements for every invariant in my code. Most of my time was spent debugging, not the first write or running code. Adding so many asserts provided a number of benefits: Assert statements are a compact form of documenting invariants, both expected and produced, making code easier to reason about. Each assert serves as a concise unit test with exactly…
Comments
Nothing yet. Say the first thing.
Sign in to join the conversation.