this post was submitted on 08 Oct 2023
999 points (96.7% liked)
Programmer Humor
25726 readers
1199 users here now
Welcome to Programmer Humor!
This is a place where you can post jokes, memes, humor, etc. related to programming!
For sharing awful code theres also Programming Horror.
Rules
- Keep content in english
- No advertisements
- Posts must be related to programming or programmer topics
founded 2 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
Just create a global object and stuff your variable in there. Now you have a global singleton and that's not a purely bad practice :D
Just call it "state management" and nobody will even care.
Not necessarily a bad practice if the singleton is immutable, and it’s provided via dependency injection for example.
As a hobby coder: "mmmhm, mmmm, mmhm... I know some of these words!"
Software dev is full of obscure keywords that describe otherwise pretty simple or basic concepts you stumble upon in practice naturally and that you probably already understand.
Here's one more of my favourite examples of such a keyword: memoization
Ahh yes memoization, the complicated way to say "remember this, I might need it again"
Important to contain all your mess to one side of the room, makes it easier to manage
Yeah yeah let's put all the eggs in one basket
So you saying, just the tip?
Ah yes. Global Objects, AKA the thinnest of condoms, lol.
That's not immutable nor a singleton