505
CompareBooleans (sh.itjust.works)
top 50 comments
sorted by: hot top controversial new old
[-] just_an_average_joe@lemmy.dbzer0.com 107 points 1 month ago

Wait areBooleanEqual returns false when they are equal?

[-] not_woody_shaw@lemmy.world 10 points 1 month ago

That's not even the worst part. What the fuck does a function named Compare_anything do? Does it return anything? It sounds like nothing but a side effect.

[-] idunnololz@lemmy.world 11 points 1 month ago

Usually comparison functions are supposed to return an integer and are usually useful for sorting. However this one returns a bool so it's both useless and terribly named.

[-] BatmanAoD@lemmy.world 7 points 1 month ago

The unnecessary and confusing functions are horrible, yes, but I'd still say that the fact that they're wrong is the "worst" part.

load more comments (1 replies)
[-] bleistift2@sopuli.xyz 85 points 1 month ago

Don’t forget the invocation

if (CompareBooleans(a, b) == true)
[-] magic_lobster_party@fedia.io 59 points 1 month ago

if (CompareBooleans(CompareBooleans(a, b), true))

[-] TriflingToad@lemmy.world 10 points 1 month ago

I don't like this thread anymore :(

load more comments (1 replies)
load more comments (1 replies)
[-] MyTurtleSwimsUpsideDown@fedia.io 18 points 1 month ago

elseif(CompareBooleans(b,a) != false)

[-] becausechemistry@lemm.ee 57 points 1 month ago

Management: Gee whiz, we really have no idea how to gauge productivity to decide who gets promoted. We could manage. Or, better, we could just have someone write a script that pulls info from git on how many lines of code each person has written.

Programmers:

[-] curiousaur@reddthat.com 22 points 1 month ago

I promote based on lines of code removed.

[-] DontRedditMyLemmy@lemmy.world 26 points 1 month ago

I quit based on idiotic metrics

load more comments (4 replies)
[-] OpenStars@discuss.online 5 points 1 month ago

Which is all the easier to do when you start off with a higher number...

load more comments (1 replies)
load more comments (1 replies)
[-] carl_dungeon@lemmy.world 53 points 1 month ago

There’s no way, that’s so insane it has layers.

[-] Ledivin@lemmy.world 18 points 1 month ago

At first, I thought the shitty methods were the joke 😱😱😱

[-] aiden@lemm.ee 50 points 1 month ago

This is code after working 16 hours

[-] Maalus@lemmy.world 11 points 1 month ago

I'd give my right hand this is a code review problem. Someone extracted a method returning true false. Then an intern came along and was told to refactor. They saw a lot of comparisons and "extracted" them.

[-] nitefox@sh.itjust.works 7 points 1 month ago

My coworker made an array of book to express a status. This is no doing of an intern but a much eviler force at play.

load more comments (1 replies)
[-] AbsoluteChicagoDog@lemm.ee 35 points 1 month ago

"You aren't writing enough lines of code!" - Management

[-] LovableSidekick@lemmy.world 8 points 1 month ago

My boss's boss, a former Ops manager who liked to keep track of system stats, once asked her why the CPU usage on the dev box had decreased that month. Weren't the devs doing any work?

[-] Grandwolf319@sh.itjust.works 30 points 1 month ago

Two wrongs don’t make a right, but sometimes in programming, two bugs can cancel each other out.

Whoever wrote this is more than capable of using it incorrectly.

[-] Omega_Jimes@lemmy.ca 21 points 1 month ago

Is this part of Elons "How many lines of choice have you written?" interview?

[-] Acters@lemmy.world 21 points 1 month ago* (last edited 1 month ago)

Those are rookie lines of code numbers right there.
I would have done it without the ==

internal static bool AreBooleansEqual(bool orig, bool val)
{
    if(orig) 
    {
        if(val)
            return false
        return true
    }
    if(val)
        return true 
    return false
}

Don't know why their code returns false when they are equal but I'm not going to dig through old code to refactor to use true instead of false.

[-] Xanvial@lemmy.world 9 points 1 month ago

you can also use XOR operation

return (X || Y) && !(X && Y)
load more comments (1 replies)
load more comments (5 replies)
[-] cyborganism@lemmy.ca 18 points 1 month ago

You can tell they're amateurs. It's not obfuscated enough. They won't be able to keep their job.

[-] Serinus@lemmy.world 19 points 1 month ago

They clearly need an abstract boolean comparison factory.

[-] marcos@lemmy.world 21 points 1 month ago* (last edited 1 month ago)
var CompareBooleans = new ComparatorFactory().BooleanComparator(new BooleanComparisonByEqualityPolicy());
if (CompareBooleans(a, b) == true) {
     System.Out.PrintLn("Sames!!!");
}

...

But now that I've written this, it's C#, so it's missing dependency injection.

[-] magic_lobster_party@fedia.io 6 points 1 month ago

I can imagine Uncle Bob be proud of this Clean Code (TM)

[-] magic_lobster_party@fedia.io 18 points 1 month ago

My guess to why there’s two functions is because it was originally only internal, and the programmer realized they needed public as well, but changing internal to public is too scary so they created a new method instead.

load more comments (1 replies)
[-] mlg@lemmy.world 17 points 1 month ago

"We need to obfuscate our code to prevent reverse engineering"

The obfuscation in question:

load more comments (2 replies)
[-] Elgenzay@lemmy.ml 17 points 1 month ago
[-] Jerkface@lemmy.world 7 points 1 month ago
load more comments (1 replies)
[-] RogueBanana@lemmy.zip 5 points 1 month ago

I can definitely understand why they did that but it's still very funny

load more comments (8 replies)
[-] zarkanian@sh.itjust.works 16 points 1 month ago

If this were a Node module, I wouldn't even be surprised.

[-] marx2k@lemmy.world 14 points 1 month ago

Clearly it should be return orig == val

Duh

[-] offspec@lemmy.world 34 points 1 month ago

To match the current behavior it should be orig != val

load more comments (1 replies)
[-] Moah@lemmy.blahaj.zone 13 points 1 month ago

I'm a bit disappointed there isn't a call to GetBooleanValue in there

[-] j4k3@lemmy.world 9 points 1 month ago

!NOT

Who's there?

!!Naughty Knots

[-] DmMacniel@feddit.org 8 points 1 month ago

But how do you test for FILE_NOT_FOUND?

[-] thenextguy@lemmy.world 8 points 1 month ago

Where are the unit tests?

[-] Treczoks@lemmy.world 7 points 1 month ago

Straight from the famous book "Making LOCs for Dummies"

[-] angrystego@lemmy.world 6 points 1 month ago

I misread it as CompareBolians. No more Star Trek memes for me today.

[-] WhiskyTangoFoxtrot@lemmy.world 5 points 1 month ago

Many Bolians died bringing us this information.

[-] LovableSidekick@lemmy.world 6 points 1 month ago
load more comments
view more: next ›
this post was submitted on 28 Oct 2024
505 points (98.3% liked)

Programming Humor

2738 readers
15 users here now

Related Communities !programmerhumor@lemmy.ml !programmer_humor@programming.dev !programmerhumor@kbin.social !programming_horror@programming.dev

Other Programming Communities !programming@beehaw.org !programming@programming.dev !programming@lemmy.ml !programming@kbin.social !learn_programming@programming.dev !functional_programming@programming.dev !embedded_prog@lemmy.ml

founded 2 years ago
MODERATORS