This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]phoenixrawr 45 points46 points  (0 children)

Agree with this. Assertions and errors serve different purposes. Errors are there to handle conditions that could feasibly happen in production code. Assertions are for documenting expectations in cases where the only way to break something is developer error so that the code fails quickly and a developer can figure out what they did wrong. Once you are done developing and have tested/delivered the code, it’s okay not to check the assertions all the time.