• DonWito@lemmy.techtailors.net
    link
    fedilink
    English
    arrow-up
    6
    ·
    1 year ago

    and I mostly work on my own projects

    Then your opinion is absolutely understandable.

    It’s also frustrating b/c types don’t guarantee that the system does-the-thing, only that the type-system and compiler are happy, so it’s like pleasing the wrong boss, or some metaphor like that.

    Types help you refactoring and communicating with other team members about expected inputs/outputs. Did you ever try debugging a number that should’ve been a string in a codebase that you didn’t write? Example from today: jsforce will throw an exception when you pass a number instead of string due to the fact that the Salesforce server will complain that the type is incorrect. If the method had correct typing of “string”, it would save me a few hours of debugging a huge library without visibility inside of it…

    • russ@programming.dev
      link
      fedilink
      English
      arrow-up
      1
      arrow-down
      1
      ·
      1 year ago

      Sounds like a frustrating issue - feels like salesforce shouldn’t be enforcing that number vs string in the first place, because it could just get coerced later on. But, it’s out of your hands for sure, and there are tradeoffs for them making their API “easier” to work with.

      And yeah I’m being a bit obstinate in this hot take - it’s easy to get away without types when working on smaller projects and in more modern languages, especially for low-stakes dev tooling. In larger projects, types can help improve confidence during large refactors.

      I just want less code to maintain in general…