• BorgDrone@lemmy.one
    link
    fedilink
    arrow-up
    2
    ·
    11 months ago

    To my experience, writing reliable code is more about the coding strategy than anything else, the language used doesn’t even make the list. And I’ve developed with pascal back in the day.

    Language makes a lot of difference in my experience. For example: a good type system can eliminate entire classes of mistakes. In Swift for example there are optional types, Non-optional types can never be nil and for optional types you have to explicitly deal with the possibility of a variable being nil. Boom, null-pointer error are a thing of the past, enforced by the compiler. One less thing to worry about.

      • BorgDrone@lemmy.one
        link
        fedilink
        arrow-up
        1
        ·
        11 months ago

        That’s not how it works. Programming is done by humans, and humans make mistakes. No amount of ‘standardising the approach’ (whatever the hell that means) or design is going to prevent humans from making mistakes.

        We keep finding security problems related to memory management: buffer overflows, double frees, etc. You think all that code is written by amateurs who don’t know what they’re doing? No, it’s written by professionals who know exactly how to prevent these things. But they are human, and they do make mistakes.

        You can either bury your head in the sand and ignore this reality, or you can do something about it. A good way is to use a language that doesn’t allow you to make these kinds of mistakes in the first place. That means a memory-safe language. That means one with strict static typing. This not only prevents bugs, it also frees up the programmer’s mental bandwidth. If you don’t have to think about accidental complexity you can put your energy into the actual problem you’re trying to solve.