• beefsack@lemmy.world
    link
    fedilink
    arrow-up
    56
    ·
    edit-2
    1 year ago

    I remember my time doing Ruby was really informative about testing and languages in general.

    The Ruby community was really great at doing automated testing and it’s actually where I really cut my teeth on testing, but if you go back and look at the tests you’ll find heaps of them are testing and checking types for functions. It almost felt like people were building static typing using automated tests.

    Some people bang on about static typing getting in the way of agility, but the reality is that you either end up spending the time creating extra tests, or you end up cutting corners and creating unreliable software which you’ll spend a lot of time troubleshooting down the road. You end up paying a big price to save a marginal amount of time at the start of a project.

    • gnus_migrate@programming.dev
      link
      fedilink
      arrow-up
      32
      ·
      1 year ago

      Also being able to prove the relationship between different parts of the code enables a lot of productivity tooling like IDEs. Simple things like renaming a class or a struct become chores at best in a statically typed language, whereas in dynamic languages there is an element of risk in refactorings like that.

    • fubo@lemmy.world
      link
      fedilink
      arrow-up
      31
      ·
      1 year ago

      Some inexperienced programmers hear “static typing” and think “Java”.

    • maegul (he/they)@lemmy.ml
      link
      fedilink
      English
      arrow-up
      13
      ·
      edit-2
      1 year ago

      Some people bang on about static typing getting in the way of agility

      With live/inline static typing checkers in editors (with, eg, VSCode’s LSP system), there’s IMO an obvious boost to “agility” in preventing minor unforced errors/bugs basically before they’re even written. Passing the right arguments to the function? Correctly processed an object or data structure? Function matches the required API? Live type checker will often answer those questions straight away without having to look up or check anything.

    • henfredemars@infosec.pub
      link
      fedilink
      arrow-up
      8
      ·
      1 year ago

      I really like the mix we have at work with Python. We type all methods, but no typing in the body unless the code is unclear. We treat it more like if it were a statically typed language with type inference. This gives the IDE loads of info to work with for refactoring and warnings. The reality of dynamic typing is more like an implementation detail.

    • kool_newt
      link
      fedilink
      English
      arrow-up
      7
      ·
      1 year ago

      Check out Crystal, it’s like static typed Ruby.