• masterspace@lemmy.ca
    link
    fedilink
    English
    arrow-up
    18
    arrow-down
    1
    ·
    edit-2
    7 hours ago

    I don’t mean this insultingly because lots of programming jobs don’t require this and for the ones that do we still tend to all start here, but in all honesty this sounds like it’s coming from someone who’s never worked on a large project maintained by multiple people over time.

    First of all, the hysteria over semicolons is ridiculous when JavaScript, Typescript, C#, Java, Go, Swift, etc. etc. wil all automatically highlight missing semicolons, if not automatically insert them for you when paired with an IDE and standard linter. On top of that, JavaScript and Typescript do not require semicolons at all, but they are still used alongside braces, because they make your code more scannable, readable, and moveable.

    Secondly, without type safety your code is no longer predictable or maintainable. If you’re working to quickly sketch out some new fangled logic for a research paper it’s one thing, if you need to write test code so that your codebase can be tested an infinite number of times by other coders and whatever CI/ CD pipelines to make sure that nothing’s broken, then all of the sudden you start seeing the value in strict typing.

    Honestly, complaining about type safety adding “extra code” is a complaint that almost every coder has when they start out, before you eventually realize that all that “extra code” isn’t just boiler plate for no reason but is adding specificity, predictability, reusability, and maintainability to your code base.

    When defining types looked like this it was one thing:

    String name = new String("Charles Xavier");

    But when it looks like this, there’s no reason not to use strong typing:

    const name = "Charles Xavier";

    • kameecoding@lemmy.world
      link
      fedilink
      arrow-up
      14
      ·
      7 hours ago

      Anyone who thinks a strong type system is a drawback has never worked on any real project where you actually have to collaborate with others.

    • Ephera@lemmy.ml
      link
      fedilink
      English
      arrow-up
      5
      ·
      6 hours ago

      Yeah, the alternative to static typing is to write tons of unit tests, which definitely adds a lot more code to your codebase.

    • Riskable@programming.dev
      link
      fedilink
      English
      arrow-up
      6
      arrow-down
      4
      ·
      7 hours ago

      without type safety your code is no longer predictable or maintainable

      This sounds like someone who’s never worked on a large Python project with multiple developers. I’ve been doing this for almost two decades and we never encounter bugs because of mismatched types.

      For reference, the most common bugs we encounter are related to exception handling. Either the code captured the exception and didn’t do the right thing (whatever that is) in specific situations or it didn’t capture the exception in the right place so it bubbles up waaaaay too high up the chain and we end up with super annoying troubleshooting where it’s difficult to reproduce or difficult to track down.

      Also, testing is completely orthogonal to types.

      • masterspace@lemmy.ca
        link
        fedilink
        English
        arrow-up
        10
        ·
        7 hours ago

        This sounds like someone who’s never worked on a large Python project with multiple developers. I’ve been doing this for almost two decades and we never encounter bugs because of mismatched types.

        Have you worked on major projects in other languages in that time period to be able to compare and contrast?

        The last two python projects I had to work on didn’t have bugs because of type issues, but it was much harder to come into the codebase and understand what was going on given that you didn’t have type information in many many places which forced you to go back and comb through the code instead.