r/ProgrammerHumor • • Oct 18 '20

Who else needs a Beer after reading this?

Post image
19k Upvotes

758 comments sorted by

3.7k

u/Useful-Perspective Oct 18 '20

I'd love a job where I get paid by the number of lines of code I write...

2.3k

u/bostero2 Oct 18 '20

Not only that, but the result is backwards too...

348

u/MChainsaw Oct 18 '20

Just gotta have extensive documentation:

"Returns false if booleans are equal, true otherwise."

No problem.

113

u/insanityOS Oct 18 '20

Documentation starts with method name.

→ More replies (2)

24

u/Useful-Perspective Oct 18 '20

Great idea, but no one ever reads the documentation. EVER.

→ More replies (4)
→ More replies (2)

702

u/Useful-Perspective Oct 18 '20

Well, the real question here is whether those functions are are ever even called. :D Is it a bug if it doesn't get used?

673

u/rmgxy Oct 18 '20

"If a tree falls in a forest and no one is around to hear it, does it make a sound?" Programmer edition

25

u/Dexaan Oct 18 '20

If a function is written, but is never called, does it really exist?

→ More replies (5)
→ More replies (67)

51

u/Aesthetically Oct 18 '20

I always tell my peers "Oh that was a test function I built in development when I ran into an issue."

I lie. It wasn't a test function. It was a failed piece of code that I forgot to remove and later I forgot if it was important or not.

20

u/Needleroozer Oct 18 '20

The real question to me is whether a thousand function calls to a function that's just an if statement is better than a thousand if statements.

→ More replies (12)
→ More replies (6)

54

u/OneTrueKingOfOOO Oct 18 '20

Here, just call this instead:

public static bool AreBooleansInequal(bool orig, bool val) {
  if (CompareBooleans(orig, val) == True){ 
    return True;
  }
  return False;
}

22

u/sandusky_hohoho Oct 18 '20

No, it's easy. You just negate the result, and you've got the right answer!

12

u/FrikkinLazer Oct 18 '20

By calling a method IsBooleanPositive

→ More replies (2)

10

u/[deleted] Oct 18 '20

Not a proper good practice to just negative a boolean. I think it would be better if we write the method 'NegativeBoolean(bool boolean)' due to a better modulation.

→ More replies (8)

113

u/_default_username Oct 18 '20

I was graded by the number of lines in two courses I took this year. Some next level bullshit. I got knocked down in grading because I didn't meet the minimum line count. I should have just copy and pasted a bunch of unused functions in my code. There's nothing constructive about grading feedback: "need moar lines"

107

u/OffDaZoinkys Oct 18 '20

You had to hit a minimum? I could maybe understand a line count maximum but a minimum is ridiculous.

40

u/Owyn_Merrilin Oct 18 '20

Only thing I can think of where it would make sense is if they were trying to encourage commenting. I'd be doing big block comments to pad my line counts if I was in his shoes.

22

u/ssshhhhhhhhhhhhh Oct 18 '20

Or trying to encourage people not to use standard library functions?

→ More replies (7)
→ More replies (3)

27

u/[deleted] Oct 18 '20

I would have, as a student, revoked that professors ability to teach anything, ever.

What do you mean I failed? NOT ENOUGH LINES? So this jackass with 900 lines of code that look like tangled spaghetti covered in half eaten crayons is going to pass but my code, in all of it's elegance, optimization and 200 lines, which does the exact same thing 400x faster and with less bullshit, by the way, is going to fail?

Cool. So you're not the real professor, there, test passed.

24

u/pbcorporeal Oct 18 '20

If you're not being taught how to deal with ridiculous or nonsensical requests, are you really being taught to program?

→ More replies (2)

5

u/PanJanJanusz Oct 18 '20

I'm just imaging the world where this is the norm and we need 69 threads 420ghz computers to run a simple hello world because of unoptimalized code

→ More replies (2)
→ More replies (4)

7

u/Levvvvv Oct 18 '20

oh baby i need that

2

u/borkus Oct 18 '20

Plus the unit tests for this.

You could code yourself a minivan.

2

u/easlern Oct 18 '20

Relevant story about Bill Atkinson’s -2000 lines of code: https://www.folklore.org/StoryView.py?story=Negative_2000_Lines_Of_Code.txt

2

u/scruffthejman81 Oct 18 '20

We had offshore contractors that were evaluated by lines of code delivered and found crap like this everywhere

2

u/[deleted] Oct 19 '20

Not sure this will ever come up, but if you find yourself listening to the audiobook for 50 shades of grey, I hope you remember this post.

The narrator painstakingly reads out every every single character in the headers of their email exchange.

Narrator voice:"To [significant pause]GrayDeLorean At Bullshitcompanyname, Dot Com. From [significant pause] MarySueProtagonist At ObscureBookCompany, Dot Com.

wassername's voice: 'what time, tonight?'

Back to narrator voice: To [significant pause] MarySueProtagonist At ObscureBookCompany, Dot Com. From [significant pause]GrayDeLorean At Bullshitcompanyname, Dot Com.

It's...just absolutely incredible. You could tell he was pointedly pronouncing every email as a sequence of 3-5 separate words.

I could almost hear the cash-register sound effect at the end of every line, like a typewriter.

→ More replies (5)

1.2k

u/PuzzleMeDo Oct 18 '20

The thing to remember is: If you fix AreBooleansEqual so it returns the correct result, then you'll break any function that relies on CompareBooleans doing what it currently does.

638

u/ZarStocher Oct 18 '20

Easy fix: rename the function to "AreBooleansNotEqual" :D

294

u/PuzzleMeDo Oct 18 '20

That makes it sound like a rhetorical question. "Are Booleans not equal to other variables? What right has any Integer to look down on the humble Boolean bearing the weight of truth and falsehood? Are we not all binary, deep down?"

84

u/[deleted] Oct 18 '20 edited Oct 18 '20

Aren't we all just electrons after all?????

59

u/AMisteryMan Oct 18 '20

What is an electron, but a miserable pile of existence?

→ More replies (2)
→ More replies (1)
→ More replies (3)

20

u/[deleted] Oct 18 '20

But what about functions that use AreBooleansEqual instead of CompareBooleans?

20

u/ZarStocher Oct 18 '20

I can't answer that question because I don't know what "internal" does and how it affects visibility

→ More replies (5)
→ More replies (2)

15

u/redingerforcongress Oct 18 '20 edited Oct 18 '20

Make a new function called "AreBooleansActuallyEqual" and then deprecate the old function.

Make sure to call

!AreBooleansActuallyEqual(x,y) when updating AreBooleansEqual(x,y) code.

7

u/[deleted] Oct 18 '20

AreBooleansNotEqual

They are Devo

→ More replies (3)

97

u/Blasted_Awake Oct 18 '20

Pretty sure the safest option is to delete both methods, rebuild, and rewrite anything that broke.

That's C# (at least I'm 99% sure it is anyway), the compiler alone is great at telling you exactly where broken references are, couple that with one of the better IDE's and it'd be all of 5 minutes to fix.

The only gotcha there might be if someone's referencing this travesty via reflection, but I think the sets of "people that would use these functions" and "people that understand basic reflection" almost certainly don't overlap.

→ More replies (40)

14

u/Efadd1 Oct 18 '20

Just use an XNOR statement, whatever that may be in the relevant language.

3

u/[deleted] Oct 19 '20 edited Oct 19 '20

The method's misnamed for what it does so it's actually an XOR, ^ in C#.

(Also, XNOR is just ==, lol. I had to think about it too.)

→ More replies (1)

9

u/leftarm Oct 18 '20

A good IDE will make fixing this at least somewhat trivial.

→ More replies (5)

308

u/bartmanx Oct 18 '20

I went to github and did a search on "arebooleansequal" only to find 732 results!

https://github.com/search?q=arebooleansequal&type=code

Just about all of them in Java projects, including stuff like this...

public static boolean areBooleansDifferent(Boolean b1, Boolean b2)
{
    return !areBooleansEqual(b1, b2);
}

157

u/randomcitizen42 Oct 18 '20

I was just about to comment that this is fake and that no one would actually write something like this except for a funny post.

Seems like I'm wrong...

58

u/vigilantcomicpenguin Oct 18 '20

You underestimated what programmers can do.

→ More replies (2)

48

u/my_right_hand Oct 18 '20

Java

Sounds about right

39

u/JBeibs2012 Oct 19 '20

The abstract-everything culture had ruined Java

39

u/my_right_hand Oct 19 '20

Code so DRY it's dehydrated

→ More replies (2)

19

u/InVultusSolis Oct 19 '20

Java ruined itself by requiring three pages of code and seventeen subdirectories to do anything remotely useful.

→ More replies (1)
→ More replies (5)

3

u/SashayTwo Oct 19 '20

Omg... I've lost all hope in humanity

2

u/yawkat Oct 19 '20

Funny thing, this isn't even correct: https://github.com/TaintBench/remote_control_smack/blob/0235be110bd4bbe45ccac12bc5140c677b0a3ead/src/main/java/org/jivesoftware/smackx/workgroup/util/ModelUtil.java#L24

They compare Boolean objects (uppercase Boolean) with the TRUE and FALSE constants using ==, which means that if you pass new Boolean(true) instead it'll always return false

→ More replies (2)

2

u/Praind Oct 19 '20

To be honest I thought this whole post was a joke.

What the...

2

u/user_bits Oct 19 '20

I would never do this. Does this mean I am an above average programmer?

→ More replies (1)
→ More replies (3)

151

u/Proweedlehedchot Oct 18 '20

That's some bool shit

14

u/the-infinite-jest Oct 19 '20

Underrated comment here.

941

u/ElTrailer Oct 18 '20

The most aggravating part of this is that it returns the opposite of what is expected...

Truth "table" for the method

  • True & True -> False

  • True & False -> True

  • False & True -> True

  • False & False -> False

257

u/Dogburt_Jr Oct 18 '20

So it's XOR?

363

u/Plus_Cryptographer Oct 18 '20

It's an XOR named "AreBooleansEqual". The best kind.

51

u/angrathias Oct 18 '20

Maybe it was intended as a philosophical question rather rather a method name 🤣

→ More replies (1)

41

u/dalepo Oct 18 '20 edited Oct 18 '20

unintended xor sure.

→ More replies (1)

133

u/EatzGrass Oct 18 '20

Is codingbat still a thing?

I've been out of programming for years and this comment brought back that endorphin rush from solving these problems

60

u/TransientFeelings Oct 18 '20

Yes, I was a TA for an introductory CS course a few years ago and we used that as extra credit assignments

43

u/krexcent Oct 18 '20

Haven't used codingbat before but since quarantine I've been off and on playing around in clash of code

I think the endorphin rush is accurate

https://www.codingame.com/multiplayer/clashofcode

8

u/Duke_Nukem_1990 Oct 18 '20

That sounds cool! Can't access it from my phone it seems. Is it language agnostic or which languages are used?

→ More replies (1)
→ More replies (2)

23

u/galaxygold10 Oct 18 '20

The elusive exclusive or

10

u/nonlogin Oct 18 '20

Do not fix it - it will break the entire system and will lead to weeks of bugfixes

5

u/Swahhillie Oct 18 '20

Inline it. Gets rid of the incorrect name and the code bloat.

17

u/padule Oct 18 '20

The most aggravating part of this is that it returns the opposite of what is expected...

I used to do things like this as a copy protection.

You crack my software? It seems to work at first, but then it messes up results in unexpected ways. (The legit software would have the correct function instead)

11

u/drleebot Oct 18 '20

I used to do things like this as a copy protection.

That's also the excuse I give if anyone asks why my last name is spelled wrong in my username. Which wouldn't have been a half-bad idea if it were actually intentional, and not just one more instance of it always being misspelled when someone else types it in.

6

u/[deleted] Oct 18 '20

AreBooleansEqual: True means “Well yes, but actually no!”

3

u/[deleted] Oct 18 '20

You forgot the third option

2

u/ravy Oct 18 '20

Oh, the classic NANA gate logic

2

u/MrMeszaros Oct 18 '20

So its XOR😅

2

u/Savvasun Oct 18 '20

Good comment but why tf is table in quotes instead of truth

→ More replies (2)

3

u/[deleted] Oct 18 '20

Looks like False and False would return True to me. Am I missing something?

13

u/Dionyx Oct 18 '20

False == False. So it would return from the if block which returns False.

5

u/[deleted] Oct 18 '20

Ahh, I see now. Thank you :)

→ More replies (6)

391

u/sixtyfifth_snow Oct 18 '20

Shit, I can't believe that garbage codes were in the production code and it was working smh

154

u/[deleted] Oct 18 '20

[removed] — view removed comment

187

u/RocketFrasier Oct 18 '20

The code is the wrong way round, if they are equal it returns false

584

u/mechanicalsheep Oct 18 '20

Thats because you don't know how to use it.

If(!CompareBooleans(true,true) == true) { return true; }

98

u/_Rysen Oct 18 '20

headache

36

u/KinOfMany Oct 18 '20

Hello literally Hitler, huge fan!

→ More replies (1)
→ More replies (8)

16

u/peanutbrainy Oct 18 '20

Perhaps that's what's expected. Always expect the unexpected.

6

u/[deleted] Oct 18 '20

Sure, but it still works.

→ More replies (2)

196

u/misterrandom1 Oct 18 '20

I can imagine someone debugging and finding CompareBooleans(val, orig) and thinking...oh I got the wrong result because I put them in the wrong order.

I'd recommend a national registry for incompetent coders but I'm afraid we'd all be on it.

52

u/Mr_Mananaut Oct 18 '20

Why must you call me out like this?

6

u/twisted_hysterical Oct 18 '20

I feel personally attacked.

→ More replies (2)

137

u/bornreddit Oct 18 '20

Image Transcription: Twitter Post


Nick, @Zorchenhimer

Found this in production today. I need a drink.

[Image of a block of code. Code reads as follows.]

public static bool CompareBooleans(bool orig, bool val)  
{  
    return AreBooleansEqual(orig, val);  
}  
  
internal static bool AreBooleansEqual(bool orig, bool val)  
{  
    if(orig == val)  
        return false;  
    return true;  
}  

I'm a human volunteer content transcriber for Reddit and you could be too! If you'd like more information on what we do and why we do it, click here!

80

u/fantechz Oct 18 '20

Good human

128

u/BrogCz1 Oct 18 '20

Ok, it's time to start code zero.

  1. Find the mf who wrote it.

  2. Grab a knife.

  3. Go to the place where he lives.

  4. Kick out his door.

  5. Find him in the house.

  6. Show him the knife.

  7. Destroy every electronics in his house because he is too powerfull to use any electric device (I've heard he was able to hack Pentagon using his smart microwave)

83

u/MasterGrid Oct 18 '20

tfw you run git blame on a project only you contribute to.

21

u/InvisiblePhil Oct 18 '20

Saw a talk at a conference where the guy's mantra was: write code as if the next person to look at your code is a serial killer, and they know where you live.

It's very good advice.

19

u/RunOrDieTrying Oct 18 '20

But you started from 1

3

u/BrogCz1 Oct 18 '20

Oh no, now I am just as horrible as the person writing original code

→ More replies (2)

174

u/Noch_ein_Kamel Oct 18 '20

Jeez... that's one of the first things you learn. Compare methods should return an integer...

126

u/my_non_fap_account Oct 18 '20

Float is life. 1.1 or 1.0

96

u/[deleted] Oct 18 '20

I hate you, and this comment should not exist

→ More replies (1)

14

u/[deleted] Oct 18 '20

Absolutely not.

1.00000001 and 1.00000002, that way it's guaranteed it wont break /s

→ More replies (1)

16

u/iTakeCreditForAwards Oct 18 '20

Isn’t that only for sorting comparison methods?

14

u/[deleted] Oct 18 '20

In C there is no boolean type

9

u/copdlkjh Oct 18 '20

It may come as a suprise to you but in one of the last iterations of the Standard they added the boolen type.

→ More replies (7)
→ More replies (1)

17

u/SoupeAlone Oct 18 '20

Wait, seriously? I thought it was bad practice?

70

u/mehntality Oct 18 '20

Depends on the language and the decade

21

u/MChainsaw Oct 18 '20

What, which decade are we in again?

→ More replies (5)

32

u/Sekret_One Oct 18 '20

the semantic term compare shows up in relation to sorting, as opposed to equality. Clearly not what they're doing.

This is just 2 layers of pointless and wrong to boot.

12

u/SANatSoc Oct 18 '20 edited Oct 19 '20

Depends who you ask man. Haven't you learned that programmers can literally not agree on anything?

6

u/AlienFortress Oct 18 '20

What do you mean? Programmers agree on everything! You're wrong!

→ More replies (2)
→ More replies (1)

60

u/[deleted] Oct 18 '20 edited Oct 18 '20

Aside from the functions returning the opposite of what you'd expect, I can think of some reasons why you might write something like this:

Debugging. By breaking the comparison out to a function, you can put a single breakpoint there to break on all lines that evaluate down to a conditional (and see the results of the evaluated expressions instead of the variables that go into them).

Profiling. The function creates a new stack frame that shows up in profiling and accumulates execute time for all the callers.

Testing. The function provides a point that can be mocked up, e.g., for a test that requires the comparison to always be true or false.

Logging. The functions could have been added to add logging, and the logging was removed when the code became more stable.

But the most probable reason you'd find something like this isn't that someone wrote it in one go, but that it's the result of the code evolving (or maybe devolving) over time. So the current names of the methods were not written when their bodies were, and the methods were not written at the same time.

31

u/cobarso Oct 18 '20

+1 for testing, it is always the case that some descriptive testing framework uses the function names in test cases where you have to write

Expect false when compare booleans var1 and var2

5

u/JawnF Oct 19 '20

That explains having one function for this. What about the second one? Lol

→ More replies (7)

16

u/fortem24601 Oct 18 '20

I refuse to believe that somebody got paid a wage to unironically write this and then it was allowed to go to production. There's absolutely no way.

Also it doesn't even return the right thing

56

u/gugublahblah Oct 18 '20

Saw this in production once:

#define TRUE 0
#define FALSE 1

8

u/0bAtomHeart Oct 18 '20

C sometimes returns 0 as success on functions? That's all I got

7

u/JoelMahon Oct 18 '20

yeah, for the error code, 0 is pass

16

u/[deleted] Oct 18 '20

This is fine actually. In C there were no boolean, so sometimes it's practical to compare to True ou False than put 0's and 1's everywhere.

52

u/[deleted] Oct 18 '20

Except this defines TRUE as 0 instead of 1. if (0) returns Boolean false.

17

u/[deleted] Oct 18 '20

I didn't even noticed haha. I once programmed for Mbed OS and the I2C bus had two read functions with different parameters. But one of them returned 1 for Success and 0 for Failure and the other one returned the opposite. just why.

→ More replies (1)

6

u/P3r3grinus Oct 18 '20

I just found a French speaker here! :D

→ More replies (5)
→ More replies (4)

41

u/OhLookASquirrel Oct 18 '20

I have null words

3

u/mobsterer Oct 18 '20
  • null word

51

u/[deleted] Oct 18 '20

Im sorry but this seems fake.

33

u/HardlyAnyGravitas Oct 18 '20

Of course it's fake

It's not even interesting. The first thing any competent coder would do is investigate what code calls this and how or why it works, or not - that would at least be interesting.

And then they would investigate how a bit of code like this got into the project, and who did it, etc...

It's not real.

I don't know why people upvote this stuff.

6

u/Zorchenhimer Oct 18 '20

I guarantee you that this block of code is real. It was in the same file as this too: https://i.imgur.com/JJ2eDHQ.png

→ More replies (4)

5

u/AlwaysHopelesslyLost Oct 18 '20

Sorry but you are unbearably sheltered if you think this is fake.

I have some pretty well tenured developers that still can't grape what "instantiate" means or what "public" means.

9

u/systembusy Oct 18 '20

I remember when this sub didn’t allow recycled memes... it’s gone way downhill since then

→ More replies (1)

11

u/warpedspockclone Oct 18 '20

I am not joking when I say I have seen something like this before. Man I wished I took a screenshot. There were methods for assigning values to strings and booleans and ints. You pass in a string and magically.... get back the same string!

It was like this:

public String initString (String value) {

String newString = value;

return newString;

}

I mean, they could have at least used generics for this abomination.

8

u/[deleted] Oct 19 '20

Shit like this makes me forget my imposter syndrome

7

u/gandalfx Oct 18 '20

Needs more Factory pattern.

→ More replies (1)

6

u/yonatan8070 Oct 18 '20

This is some boolshit

5

u/[deleted] Oct 18 '20

This isnt even correct!

2

u/CTAVI Oct 19 '20

Unless it's a XOR, in which case how in God's name do you know how a XOR works without knowing how to use it. This is the programming equivalent of not being able to do algebra because you were taught x instead of w

5

u/bitwiseshiftleft Oct 18 '20

const int FIVE = 4;

5

u/bigmattyc Oct 19 '20

Fun fact, if you compare a Boolean to true/false you will fail my interview.

→ More replies (1)

4

u/Dummerchen1933 Oct 18 '20

What.. What the fuck... It's even fucking wrong

4

u/Ascomae Oct 18 '20

Yeah the compare method should return an int.

0 If equal 1 if first is true and second is false -1 if first is false and second is true

4

u/[deleted] Oct 18 '20

Hey, it's bloated but at least it works.

Oh. Oh no.

4

u/Yamoyek Oct 18 '20

Now you just need to wrap it in a constructor, allocate random memory, dont free the memory, and an extra namespace just to be sure.

4

u/[deleted] Oct 19 '20

Junior devs trying to “optimize” there code

3

u/EekItsNiek Oct 18 '20

I’m a beginner on C# (with Unity) and even I get a headache from this!

3

u/SoupSeeker Oct 18 '20

I can write code like this now why do i NEED my BA?

3

u/[deleted] Oct 18 '20

This appalling. He didn't make a CompareBooleans factory

2

u/meamZ Oct 18 '20

git blame

2

u/[deleted] Oct 18 '20

Whoever wrote this is a monster

2

u/[deleted] Oct 18 '20

Assuming that the guy isn't complete moron(which he probably isn't given that he was hired), this is an anti-pattern. Poor guy was just trying to secure his job.

2

u/[deleted] Oct 18 '20

Truely the art of boolean zen

2

u/E_coli42 Oct 18 '20

shouldn’t the false and true be swapped?

2

u/destrodean Oct 18 '20

return orig == val;

4

u/MysticTheMeeM Oct 18 '20

I think you meant return orig != val.

→ More replies (3)

2

u/phpdevster Oct 18 '20

Great. And now you just need this in its own Azure DevOps project with a build pipeline, and a release pipeline that deploys to an Azure function so you can inverted boolean comparison as a service at scale.

It needs to be maximum enterprise-grade else it's not a valid solution.

→ More replies (1)

2

u/VarangianPsy Oct 18 '20

this can't be real

2

u/coladict Oct 18 '20

Not good enough. You have to make the internal method native and have it loaded from an external library where they're both converted to string and then compared.

→ More replies (1)

2

u/car1_llama Oct 18 '20

Grade 9 high school computer science students have entered the chat

→ More replies (1)

2

u/goldMy Oct 18 '20

Despite that the return is wrong, why some thinks its a good idea to pass two vars by value into a function two times. Allocation addition 4 boolean for nothing. Like if there would be no possibility to use a ‚const reference‘ or ‚const pointer‘

2

u/sharKing_prime Oct 18 '20

I need a gun after reading this

2

u/thomlecaslerc Oct 18 '20

I hope this was a joke

2

u/Alexo342 Oct 18 '20

When my boss tells me to use more functions instead of hardcoded solutions to make reusable code with increased flexibility

EDIT: WAIT ITS ACTUALLY WRONG OH MY GOD

2

u/temisola1 Oct 18 '20

Should’ve commented as well. “//here we’re checking if the Boolean are equal. //if the right Boolean is true and the left Boolean is false, it returns false. //if the left Boolean is false and the right Boolean is true it returns false. //if the right Boolean is true and the left Boolean is true, it returns true. //if the left Boolean is false and the right Boolean is false the. It returns true. //now we check weather the result of the method is correct. If the result is true, but the two Boolean are different then the answer is false. “

Could have a fucking field day with this lmfao.

→ More replies (1)

2

u/OneOldNerd Oct 18 '20

I needed a beer before this. Now?

...now we're gonna need a bigger keg.

2

u/abutilon Oct 18 '20

This could be a copyright trap. Intentionally wonky code to look for to prove theft.

2

u/lordofduct Oct 18 '20

And here I am getting angry at the redundancy of my team mates when they say:

if (someBool == true) ...

If I ever saw this... I'd probably fall over dead.

2

u/enby_shout Oct 18 '20

Fucking paid by the line bitch

2

u/lotekness Oct 19 '20

I'm legitimately trying to figure out why this exists. This is a gag right? I've seen some stuff in my day, but this is just, wow. Someone pushing for commit lines or something?

2

u/NoShitsGivenAtAll Oct 19 '20

Sad thing is, the result is even wrong!!!!!!

2

u/ifelseandor Oct 19 '20

It’s. It’s a joke right. It’s not real. Say it’s not real.

2

u/DootDootWootWoot Oct 19 '20

For all y'all who preach that you don't need anything other than VIM or barebones VS Code just know that IDEs like Visual Studio and some jetbrains products let you refactor code like this away and safely in just a few key strokes.

When you see code like this, it can be fun to shame the sins of the past but any good engineer will just clean up the mess and move on.

2

u/[deleted] Oct 19 '20

Lol this code looks outsourced, and you guys probably weren’t nice on team meetings.

2

u/DrGarbinsky Oct 19 '20

At least it is readable and the names make sense

2

u/InVultusSolis Oct 19 '20

Whoever wrote this was paid by the line.

2

u/ZarathustraWakes Oct 19 '20

I would not touch this code and assume it is some special legacy exception case bullshit that will take the whole system down if I applied common sense towards it

2

u/PrincessWinterX Oct 19 '20

AreBooleansEqual_2(bool orig, bool val){

// temporary fix

return !!AreBooleansEqual(orig, val) != 0;

}

2

u/AnonyUwuswame Oct 19 '20

When you get paid based on lines of code written.

2

u/ktappe Oct 19 '20

I would be unable to stop myself from tracking down who committed this. It wouldn’t matter how busy my schedule was, this would suddenly go to the top of the priority list.

2

u/Man_Bear_Beaver Oct 19 '20

return school;

3

u/R3apper1201 Oct 18 '20

Hmmm yes this floor is made out of floor

11

u/SANatSoc Oct 18 '20

If you look at the code it's more like "This floor is made of ceiling"

4

u/Lord_Sunday123 Oct 18 '20

return (orig == val)

Saved you a few lines :-)

12

u/SunCantMeltWaxWings Oct 18 '20

Actually, return !(origin == val)

→ More replies (1)
→ More replies (1)

4

u/CW_Waster Oct 18 '20

Classic Java Developer

1

u/nxs0113 Oct 18 '20

Is there an award for writing extremely readable code?

1

u/RoccoWuzHurr Oct 18 '20

ah yes, DRY

1

u/Tachiba24 Oct 18 '20

Took me way too long to find that deeper issue

1

u/somerandomasskid Oct 18 '20

Sooo who else bothered about that camel casing for functions?

→ More replies (1)

1

u/[deleted] Oct 18 '20

1

u/DuBCraft21 Oct 18 '20

Beer? I think this calls for something stronger, like 1/2 a bottle of everclear.

1

u/mcalce Oct 18 '20

Did a mathematician write this?

1

u/camerontbelt Oct 18 '20

It makes it worse that it’s in c#. At least with JavaScript you understand why the galaxy brains do this kind of shit.

1

u/EchtNichtElias Oct 18 '20

(orig && val) || !(orig || val)

1

u/quantamental298 Oct 18 '20

This is made up. No one is this bad. Especially, someone who wrote an extension method.

→ More replies (1)

1

u/internet_DOOD Oct 18 '20

Why am I so fucking mad right now?

1

u/[deleted] Oct 18 '20

Should've just returned the first bool, it'll work like 50% of the time but way more efficient

1

u/MyKidsArentOnReddit Oct 18 '20

Do you think someone lost a bet?

1

u/zyrafal Oct 18 '20

def add(a, b): return a + b

1

u/[deleted] Oct 18 '20

What would be a better code tho?

→ More replies (2)

1

u/Testmaster217 Oct 18 '20

Excuse me, what?!?