r/badcode • • Nov 26 '19

c# String Strang String Strang

Post image
776 Upvotes

54 comments sorted by

296

u/totallynormalasshole Nov 26 '19

I've chosen to believe the first 114 lines are just this guy doing the same thing with every other type.

public Double Daable()
...
public void Daable(Double daable ...
public Float Flaat()
...
public void Flaat(Float flaat)
...

216

u/null_reference_user Nov 26 '19

You're actually right

136

u/totallynormalasshole Nov 26 '19

That's horrifying, thank you.

31

u/zigs Nov 26 '19

Thanks, I hate it

27

u/gary-mcgaryson Nov 26 '19

I am uncontrollably laughing on the bus. This is amazing.

41

u/[deleted] Nov 26 '19
git rm *
git commit -am "You can do better than this. Also, see you in my office in five."
git push -f origin master

10

u/Sarenord Nov 26 '19

this is the solution to when you write hundreds of lines of code without testing any of it on a stimmed out bender, then wake up the next morning to discover that you, in your mania, thought it would be funny to name all of your types like this. Since we're still at least a decade away from having computers that are advanced enough to do search and replace, this seems like the best way to do it to me.

38

u/null_reference_user Nov 26 '19

#define baalean bool

#define Strang string

#define yeet return

47

u/Sarenord Nov 26 '19

I'm using #define yeet return in all of my code from here on out

7

u/GOKOP Nov 26 '19

That's brilliant

18

u/andiconda Nov 26 '19

OMG #define yeet return is going to change my life. Thanks for enlightening me.

3

u/[deleted] Nov 26 '19

I have a feeling that whoever wrote that, came from Java because there is no keyword for boolean, and it looks like a bunch of Getters and Setters.

1

u/null_reference_user Nov 26 '19

Another comment got it right, it's Java code in C#'s conventions. I was converting some Java into C# and this was just too funny and random not to post.

81

u/[deleted] Nov 26 '19

Why...?

62

u/rfinger1337 Nov 26 '19

I would guess the author isn't a native English speaker and this is a translation to make it more intuitive for them.

98

u/[deleted] Nov 26 '19

Yeah no, I don't buy that, especially when you have to actually write the type name every single time

25

u/yaxamie Nov 26 '19

I think they are "boxing" primitive types.

51

u/VioletteKaur Nov 26 '19

I guess someone did drugs and found it funny spending hours doing this bs. In what world would that be more intuitive?

12

u/[deleted] Nov 27 '19

It's a translation into an Australian accent

4

u/SarahTheBlue_ Nov 27 '19

LOL. noooiice

22

u/netinept Nov 26 '19

Job security?

50

u/[deleted] Nov 26 '19

what the hell is this

29

u/Flamme2 Nov 26 '19

C#? I don’t think boolean is a valid type in c#. I think it is in Java though

32

u/_Stego27 Nov 26 '19

the fact that the linter has underlined them probably means they are trying to use java types (String, boolean) in C# which uses (string, bool). This just adds to the horror

11

u/Joniator Nov 26 '19

But String would work in C#, even if it is discouraged to use it

9

u/_Stego27 Nov 26 '19

I think it needs an import though

11

u/Dalimyr codes in C#...poorly Nov 26 '19

Yup, but only because it's capitalised. It's System.String. If it had been string without a capital then it would have been perfectly fine even without System. or using System;

4

u/_Stego27 Nov 26 '19

Yeah, in this case they have used the Java String (does not need an import in java) but the c# linter is rejecting it because they have not imported System.

1

u/[deleted] Nov 26 '19

I think Boolean will work as a class name, like how int can be Int32 and string can be String. I dont have a terminal around right now though.

Edit: and it has to be capitalized, so this is java that looks like c#

55

u/def_hass Nov 26 '19

The fact that its Java types with C# conventions just makes it better

10

u/wischichr Nov 26 '19

What do you mean with java types?

53

u/woubuc Nov 26 '19

Java uses the basic type boolean like in the image, whereas C# uses bool instead. But starting method names with a capital letter is decidedly a C# convention and is not really done in Java.

3

u/fmv_ Nov 27 '19

I haven’t been using Java long but mVarName is a C# thing too.

26

u/AxelMontini Nov 26 '19

This is cursed

7

u/VioletteKaur Nov 26 '19

Guess someone likes Whales... and is insane..

7

u/KingErroneous Nov 26 '19

I am a programmar.

I am a porgammar.

I am a programer.

I write code.

6

u/Piotyras Nov 26 '19

public boolean Baaleanot() { return !mBaalean; }

5

u/PeterBumpkin Nov 26 '19

while this qualifies as bad code, often I find myself having fun with expressions - sometimes help stave off the drudgery sometimes

4

u/brandondyer64 Nov 26 '19

mBaalean

3

u/[deleted] Nov 26 '19

Taaps faadorae

2

u/cthart Nov 26 '19

WTF?! Let's fix compilation errors by writing more code.

1

u/[deleted] Nov 26 '19

Inb4 this is why getting paid by the line of code is bad

1

u/[deleted] Nov 26 '19

i guess that 'strang' var is the first var of string. if need more variable in same type it become 'strbng'. baalean bbblean. dauble dbuble.

1

u/when_it_lags Nov 27 '19

Clear effects of drugs.

1

u/[deleted] Nov 27 '19

stonks!

1

u/EternityForest Nov 28 '19

Raise your vigor raise your voice! String, string, string with me!

1

u/DanTactical Nov 26 '19

Wtf did I just see

0

u/kewlness Nov 26 '19

I do not have enough scotch for this...