• BehindTheBarrier@programming.dev
    link
    fedilink
    arrow-up
    6
    ·
    4 hours ago

    Code normally works fine after you write it and then hopefully at least test by hand. The new guy 5 years later, which do not fully grasp the extent of his actions, and the guy reviewing the code also not being too familiar with it, will not make sure everything does as intended.

    Tests are correctness guarantees, and requires the code and/or the test to change to pass. They also explain how something should behave to people that don’t know. I work in a area where there are so many businesses rules that there is no one person that knows all of it, and capturing the rules as tests is a great way to make sure that rules remains true after someone else comes to change the code.