this post was submitted on 06 Jul 2023
78 points (100.0% liked)

Programming

17443 readers
168 users here now

Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.

Hope you enjoy the instance!

Rules

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If you're posting long videos try to add in some form of tldr for those who don't want to watch videos

Wormhole

Follow the wormhole through a path of communities !webdev@programming.dev



founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
[โ€“] KelvinDegrees@lemmy.world 7 points 1 year ago (1 children)

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@programming.dev 1 points 1 year ago* (last edited 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! ๐Ÿ‘