• @KelvinDegrees@lemmy.world
    link
    fedilink
    English
    71 year ago

    I’ve become a big proponent of static typing and the functional programming paradigm, both of which solve the problem of figuring out what you’re looking at.

    With OOP and side effects you can receive a variable but still not know what it really is, is it modified somewhere before or after that you missed? Is it passed deep into nested functions that modify it? Who knows! With pure functions that goes away completely, you can easily inspect what goes into it.

    Static typing also solves, among many other problems, this same issue. I’ve written a good deal of python, and anytime I go from rust, my current love affair, back to python I end up needing to take a break and go to my dog for emotional support. I’ve tried using mypy for static type analysis, I still use it, but it’s very far from perfect; not least because many of the scientific libraries I use don’t implement static type hints and are in fact written in such a way that implementing them would be difficult or nonsensical in some instances. It’s a complete nightmare. The only solution would be every one of these libraries rewriting themselves, so not likely.

    • JavaCodeWriter
      link
      fedilink
      English
      1
      edit-2
      1 year ago

      As someone who works extensively in Java, I agree, side-effects are tough and should be avoided in OOP. A lot of teams are moving toward more of an immutable object pattern as a standard, but its tough to enforce and adds a lot to the verbosity of the language.

      Rust is a language I am currently in the process of learning and it seems great! 👍