There have been multiple accounts created with the sole purpose of posting advertisement posts or replies containing unsolicited advertising.

Accounts which solely post advertisements, or persistently post them may be terminated.

PoolloverNathan ,

I present to you quality variable names. (and a Mount Rustmore)


<span style="color:#323232;">(Reconfigure(f), </span><span style="color:#183691;">'c'</span><span style="color:#323232;">) </span><span style="font-weight:bold;color:#a71d5d;">=> </span><span style="color:#323232;">{
</span><span style="color:#323232;">    </span><span style="font-weight:bold;color:#a71d5d;">let mut</span><span style="color:#323232;"> p: Vec<</span><span style="font-weight:bold;color:#a71d5d;">&str</span><span style="color:#323232;">> </span><span style="font-weight:bold;color:#a71d5d;">= </span><span style="color:#323232;">vec![];
</span><span style="color:#323232;">    </span><span style="font-weight:bold;color:#a71d5d;">loop </span><span style="color:#323232;">{
</span><span style="color:#323232;">        </span><span style="font-weight:bold;color:#a71d5d;">match</span><span style="color:#323232;"> args.</span><span style="color:#62a35c;">next</span><span style="color:#323232;">() {
</span><span style="color:#323232;">            </span><span style="color:#0086b3;">Some</span><span style="color:#323232;">(k) </span><span style="font-weight:bold;color:#a71d5d;">=> </span><span style="color:#323232;">{
</span><span style="color:#323232;">                </span><span style="font-weight:bold;color:#a71d5d;">if</span><span style="color:#323232;"> k </span><span style="font-weight:bold;color:#a71d5d;">== </span><span style="color:#183691;">"=" </span><span style="color:#323232;">{
</span><span style="color:#323232;">                    </span><span style="font-weight:bold;color:#a71d5d;">match</span><span style="color:#323232;"> args.</span><span style="color:#62a35c;">next</span><span style="color:#323232;">() {
</span><span style="color:#323232;">                        </span><span style="color:#0086b3;">None </span><span style="font-weight:bold;color:#a71d5d;">=> </span><span style="color:#62a35c;">q</span><span style="color:#323232;">(</span><span style="color:#183691;">"need value for Rc"</span><span style="color:#323232;">),
</span><span style="color:#323232;">                        </span><span style="color:#0086b3;">Some</span><span style="color:#323232;">(v) </span><span style="font-weight:bold;color:#a71d5d;">=> </span><span style="color:#62a35c;">u</span><span style="color:#323232;">(
</span><span style="color:#323232;">                            f,
</span><span style="color:#323232;">                            |f| </span><span style="color:#0086b3;">Box</span><span style="color:#323232;">::new(
</span><span style="color:#323232;">                                |c| {
</span><span style="color:#323232;">                                    </span><span style="color:#62a35c;">f</span><span style="color:#323232;">(c);
</span><span style="color:#323232;">                                    c.</span><span style="color:#62a35c;">set</span><span style="color:#323232;">(p.</span><span style="color:#62a35c;">iter</span><span style="color:#323232;">().</span><span style="color:#62a35c;">copied</span><span style="color:#323232;">(), v);
</span><span style="color:#323232;">                                    </span><span style="font-weight:bold;color:#a71d5d;">for</span><span style="color:#323232;"> e </span><span style="font-weight:bold;color:#a71d5d;">in</span><span style="color:#323232;"> p {
</span><span style="color:#323232;">                                        </span><span style="font-weight:bold;color:#a71d5d;">unsafe </span><span style="color:#323232;">{
</span><span style="color:#323232;">                                            </span><span style="color:#0086b3;">Box</span><span style="color:#323232;">::<</span><span style="font-weight:bold;color:#a71d5d;">str</span><span style="color:#323232;">>::from_raw(
</span><span style="color:#323232;">                                                std::mem::transmute(e)
</span><span style="color:#323232;">                                            );
</span><span style="color:#323232;">                                        }
</span><span style="color:#323232;">                                    }
</span><span style="color:#323232;">                                }
</span><span style="color:#323232;">                            )
</span><span style="color:#323232;">                        )
</span><span style="color:#323232;">                    };
</span><span style="color:#323232;">                    </span><span style="font-weight:bold;color:#a71d5d;">break
</span><span style="color:#323232;">                } </span><span style="font-weight:bold;color:#a71d5d;">else </span><span style="color:#323232;">{
</span><span style="color:#323232;">                    p.</span><span style="color:#62a35c;">push</span><span style="color:#323232;">(</span><span style="color:#0086b3;">Box</span><span style="color:#323232;">::leak(k.</span><span style="color:#62a35c;">into</span><span style="color:#323232;">()));
</span><span style="color:#323232;">                }
</span><span style="color:#323232;">            }
</span><span style="color:#323232;">            </span><span style="color:#0086b3;">None </span><span style="font-weight:bold;color:#a71d5d;">=> </span><span style="color:#62a35c;">error</span><span style="color:#323232;">(</span><span style="color:#183691;">"need path element or = for Rc"</span><span style="color:#323232;">),
</span><span style="color:#323232;">        }
</span><span style="color:#323232;">    }
</span><span style="color:#323232;">},
</span>
lseif ,

what is this for ?

PoolloverNathan ,

Argument parsing; turning Rc foo = bar into Reconfigure(|c| c.foo = “bar”).

kromem ,

Ok, but what variable is 🐈?

driving_crooner ,
@driving_crooner@lemmy.eco.br avatar

Is the function to con🐈eate and print.

sirico ,
@sirico@feddit.uk avatar

It took me too long to figure out the I in an if statement was just integer

PotatoesFall OP ,

In a for statement, it often refers to index

ILikeBoobies ,

Am I being gaslit?

rickyrigatoni ,

Gasboss gatelit girlkeep

exanime ,

How dare you… <Eye squint>

Strawberry ,

mathematician here, where is the joke?

humbletightband ,

This joke is funny only if placed in Arnold-Atyah manifold if Kolmogorov-Ramachandran-Yu metric is defined

CanadaPlus , (edited )

So don’t use it in non-KRY-definite AA situations, or you could get erroneous results. QQX is fine though, as long as you have non-vanishing ABCD. /s

I wonder if Lean proofs become the new peer review like I’ve heard suggested, if mathematics might break from this, and look more compsci-ish in the future. That way non-specialists could get up to speed quickly.

BleatingZombie ,

Variable names should be “self defining” meaning you should be able to understand what its doing from the name. The name also shouldn’t be too long. Combining those together makes it difficult to come up with an “elegant” name

PotatoesFall OP ,

I think they got the joke, they were just joking about how this is common in math :P

Strawberry ,

The most atrocious variable names I ever encountered in code were as a research assistant for a math professor doing game theory simulations. Literally unreadable unless you had a copy of his paper on the subject to refer to

menas ,

tmp3 = tmp1 + tmp2 ; T.T

KillingTimeItself ,

in the linux community it’s really common to have applications like MPD, music player daemon, or MPC, music player client, and ncmpc, ncurses music player client, and ncmpcpp the aforementioned one with ++ tacked onto the end.

Cmus, which from what i can recall is literally “c music player”

etc…

PoolloverNathan ,

fia? fir? fib (part of fia)?

KillingTimeItself ,

exercise left up to the developer!

Daft_ish ,

Now I want to become a programmer so I can give variables people names.

trolololol ,

Ha

You should hear of the method of pretending you’re at breakfast or some other anthropomorphized situation, where you name things as butter and cheese, knife and bread, tea and teapot

Then there’s Hungarian notation which is actually used seriously. But I can’t give an entertaining example only s boring and probably inaccurate one.

some_guy ,

Why is no one giving credit to my friend n?!

explodIng_lIme ,

for whatever in stuff:

Buddahriffic ,

for myList in myElement:

CandleTiger ,

You need to use trigger warnings for this kind of shit.

JATtho ,

name your function as malloc() and see to world burn and generate bugs at factorial rate.

trolololol ,

If you name it malloc it will be easy to notice. On the other hand if you call it free…

MonkderDritte ,

No, that’s math.

gandalf_der_12te ,

How to write spaghetti code:

ZILtoid1991 ,

Then you realize your code is undebuggable because half the functions and variables have single-letter names or called foo, bar, baz, etc.

Hazzia ,

Especially when you reuse each of those names for all the scopes you have

ObsidianNebula ,

I have a somewhat related real world story. I had a client that was convinced that tons of people were going to decompile their application and sell their own version of the program, so they insisted that they needed their code obfuscated to protect company secrets and make it harder to reverse engineer. I tried explaining to them that obfuscation wasn’t that big of a deterrent to someone attempting to steal code through reverse engineering and that it would likely cause some issues with debugging, but they were certain they needed it. Sure enough, they then had a real user run into an issue and were surprised to find that their custom logging system was close to useless because the application was outputting random obfuscated letters instead of function and variable names. We did have mapping files, but it took a lot of time to map each log message to make it readable enough to try to understand the user’s issue.

Johanno ,

This is why you obfuscate after you code. Just obfuscate the release build. And logging may at that point be thrown out of the window anyway

ObsidianNebula ,

It was obfuscated only in the release build. The issue is that they have a system to send certain logs to an API so they can refer to them if a user has an issue that needs further investigation. Unfortunately, their target audience is not very tech literate and have a hard time explaining how they got into a situation where they experienced a bug, so the remote logging was a way to allow us to try to retrace the user’s steps. Some of the logs that get sent to the API have JSON values converted from class data, will refer directly to class names, etc, and those logs had the obfuscated names.

Johanno ,

Well then you are fucked.

The question is if nobody else has access to the logs, then obfuscation is stupid

AnarchistArtificer ,

I was learning python as a wee scientist in training, and my variables were beyond dreadful. I tried naming a list “list” and the interpreter told me I couldn’t, so I opted for “listy”. When I needed to name a new list but listy was taken, I’d often resort to “listyy”.

Scientists who work with computers without having much (if any) targeted training on how to code can write the most horrendous programs.

RandomVideos ,

Since a lot of the english words i know i learned from minecraft, in a farming simulator i named tilled soil"hoed"

I had multiple variables like int isHoed

velvetThunder ,

There’s some hoed in this house If you see 'em, point 'em out

lars ,

An important professor constantly and frustratingly said

we can call this variable whatever we want, so we’ll call it Fred

Made me panic and irate and focus on the wrong part of the problem. Every. Single. Time.

  • All
  • Subscribed
  • Moderated
  • Favorites
  • [email protected]
  • random
  • lifeLocal
  • goranko
  • All magazines