61
Code Smells Catalog (luzkan.github.io)
you are viewing a single comment's thread
view the rest of the comments
[-] FizzyOrange@programming.dev 1 points 2 days ago

it’s an easy refactor to make it not global

I have enough experience to know that making global state non-global is usually anything but easy.

[-] Boomkop3@reddthat.com 0 points 2 days ago

Damn, suppose I won't just pass it as a pointer from the call site. That'd be so difficult to add an int to a struct

30 years my ass

[-] FizzyOrange@programming.dev 1 points 1 day ago

Yes, and then pass the context from the call sites of that function, and all the way up to main(). Oh look you're refactored the entire app.

That's best cases too, you'd better hope your program isn't actually a shared library running in a SystemVerilog simulator with state instantiated from separate modules via DPI, or whatever.

30 years my ass

lol when you have 30 years experience you will have actually tried to do this a few times and realised it isn't usually as trivial as you hope it would be.

[-] Boomkop3@reddthat.com 0 points 1 day ago

That's not a great approach, but you do you

this post was submitted on 05 Jan 2025
61 points (90.7% liked)

Programming

17788 readers
173 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 2 years ago
MODERATORS