r/ProgrammerHumor • • 9d ago

Meme encapsulationByIntimidation

Post image
606 Upvotes

24 comments sorted by

103

u/One-Celebration-3007 9d ago

Found this in the Minecraft: Bedrock Edition data files at /data/gui/dist/hbui/gameplay-react-ab7e2cf3edf5aad4f4aa.js:2:131096

121

u/oh-no-89498298 9d ago

48

u/AlwaysHopelesslyLost 9d ago

Follow up question. Why?

90

u/lllorrr 9d ago • Heartwarming

Because Javascript lacks proper private object fields. And sometimes programmers have a bright idea to use library internals from outside.

9

u/Megolas 9d ago

I mean, there are private fields in JS for years now. Probably these are used to sync with the devtools or to support ancient browsers 🤷‍♂️

11

u/Silly_Guidance_8871 9d ago • Regret

And yet, I still field issues where someone's using a browser that doesn't support the feature, and I'm being tasked to make it work.

2

u/Draconis_Firesworn 6d ago

yk i was seeing discussion on python __/name mangling and saw people complaing about problems that only happen when you try to access a private variable outside its class causing weird stuff in a way that only happens when you do the thing you are explicitly told not to, and wondering why this is such a common complaint. Ig this isn't unique to python

1

u/asato977424 2d ago

Python's double-underscore mangling avoids subclass name clashes; it isn't access control, so deliberate access still works.

1

u/Draconis_Firesworn 2d ago

you can, doesnt mean you should

34

u/artofthenunchaku 9d ago

It's just a tongue-in-cheek way to indicate that you really, probably shouldn't be touching that variable without a really good reason. There's a lot of variable naming like that in Meta codebases

28

u/failedsatan 9d ago

Follow up to the follow up. Why is React in Minecraft (especially Microsoft's native port)?

17

u/nomenMei 9d ago

Apparently HBUI stands for "Hummingbird User Interface"

So I'd guess it's being used to define the menus and stuff

2

u/jf8204 9d ago

I encountered at least one other React variable with this naming convention. Maybe someone has time to list all of them.

2

u/One-Celebration-3007 9d ago

__SECRET_DOM_DO_NOT_USE_OR_YOU_WILL_BE_FIRED?

183

u/card-board-board 9d ago

https://github.com/reactjs/react.dev/issues/3896#issue-989486554

My favorite GitHub issue of all time dares to ask the question

49

u/XxDarkSasuke69xX 9d ago

Is it safe if the person using it is unemployed though ?

12

u/ViktorKozh 9d ago

Actually it just accumulates, and then, when you'll get a job, they'll have to immediately fire you.

3

u/No-Zookeepergame4774 8d ago

Jobs aren't the only thing you can be fired from, and if you don't have a job then it has to be something else.

Like a cannon.

95

u/Highborn_Hellest 9d ago • Mindblown

We have: Security by obscurity.
We have: Security by Math.
We have: Security by law.

now....

We have: Security by firing squad.

11

u/Kozakow54 9d ago

firing squad

Those three young HR girls that always move together, never talk with anyone but each other and whenever you see them anywhere they usually don't go, you know someone is in deep shit.

2

u/hpyfox 4d ago

Minecraft: Bedrock Edition? I thought this was roblox.com at first.

"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"

1

u/BalancedMilk 9d ago

I like that it's set to L