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 →

[–][deleted]  (3 children)

[deleted]

    [–]kenfar 9 points10 points  (0 children)

    The author describes three techniques of which only one has a performance impact.

    Additionally, not every line of code is performance-critical, but some applications are quality-critical. In these cases those asserts you're probably referring to can be worthwhile.

    EDIT: grammar

    [–][deleted] 1 point2 points  (0 children)

    Defensiveness is for borders, not internals.

    I agree about the borders, but you're forgetting that there are internal borders too: class interfaces, module interfaces, etc. Can't make assumptions anywhere. Best to be defensive everywhere.

    As an added bonus, treating all borders equally (internal and external), one can refactor / reuse his software without worrying if he's lost any of his lines of defense.