194
u/AnotherBrug Apr 25 '21
Imagine you apply to a job and you are nervous so you log onto reddit to relax and you see your code in r/badcode 😳
104
Apr 25 '21 edited Apr 25 '21
Bad manners all around. I wouldn’t want OP as teammate either.
As bad as candidates can be, there has to be some mutual respect. This goes even after you reject them.
Edit: Some advice on good etiquette while interviewing. Hopefully OP wasn't as condescending in-person. Remember that candidate could've submitted this code in a number of situations:
Maybe they are fresh out of college and no experience with IDE
Maybe they are going through a lot of job applications and stressed out
Maybe they wrote decent code but took easy way out for unit tests
folks are loosing their livelihood in COVID and that's not how you treat someone who is looking for a job.
4
u/Snackomat Apr 26 '21
I might need to clear up some confusion here. This is not a professional application, neither did we have a formal interview with him. He wanted to apply to a community project. The process is simply filling out a form and then having to solve an example problem. This is what they submitted.
Having said that, I thought this would be interesting to share as it takes quite some audacity to apply with a monstrosity like this. I'm still working with him and trying to help him make the best out of this, so I doubt I'm condescending there. Ultimately that is up to you to judge.2
u/TheLifey Apr 30 '21
Hello! What is the community project? Is it working on a SCP game in a C# game engine or Unity? I'd be glad to follow and/or contribute.
48
u/Jmc_da_boss Apr 25 '21
This code is so poor it deserves no respect, i would expect better from a CS student in cs101
71
u/robert-at-pretension Apr 25 '21
The code is disgraceful, yea. We’re talking about the human who wrote the code who does deserve respect.
12
u/Jmc_da_boss Apr 25 '21
This code is so bad, that it was disrespectful to even submit it to a job application. Theres no need to defend the honor of someone who so clearly cares nothing about other peoples time.
25
u/SeesawMundane5422 Apr 25 '21
People don’t necessarily know they are bad at something until someone explains or shows them how and why to do it better. Why assume malice when incompetence is a perfectly good explanation?
14
u/droomph Apr 25 '21
I don’t submit applications to be a civil engineer and just go “oops” when I don’t know what the difference between rebar concrete and regular concrete is, or whatever the 101 is for that. Or like, I don’t apply to be an accountant just because I can use TurboTax.
There’s a certain level of “I know I don’t know” that everyone should have.
1
u/MasculineCompassion Apr 25 '21
Bruh, look at that code. They clearly had no idea what they were doing, or they were trolling.
2
u/SeesawMundane5422 Apr 25 '21
You: “Clearly had no idea what they were doing” Me: incompetent
Aren’t those the same thing?
7
u/Kyn21kx Apr 25 '21
While I can totally see what you mean here, as u/SeesawMundane5422 pointed out, not everyone knows they're bad, or perhaps they just really need a job, we can't really judge bc we don't know the full scope of this person's situation...
HAVING SAID THAT
I don't think it is entirely disrespectful from OP to share this, I think we can all look back at the code we've written long (or in some cases not so long) ago, and just wonder what the hell were we thinking, highlighting this as bad code could potentially lead other people to learn why this is bad, and how they can improve if they ever see themselves in similar situations
1
u/1_4_1_5_9_2_6_5 Apr 27 '21
Yeah but this is the kind of code that shows that 1) the person writing literally doesn't know how to use an if statement and 2) they don't even bother to test their code before publishing it. What kind of programmer is that? Someone who read the first page of a book on programming and figured it was good enough to get a job.
1
u/ZeCactus Apr 25 '21
Maybe they are fresh out of college and no experience with IDE
I wouldn't expect code like this even straight out of high school.
1
u/Florian0205 Apr 26 '21
Thank you for thinking of others.
But I think you need to know some background.
The person who wrote this code applied to join the devteam of our gaming community.
Like me, he still goes to school. Just to let you know he's not looking for a job.
He's new to C# and we sometimes give him some advice.
The code you saw is the first code he send to us.1
u/1_4_1_5_9_2_6_5 Apr 27 '21
What is he going to school for? I highly doubt its anything programming related, unless he's failing.
37
u/IGambleNull Apr 24 '21
kekw I hope we don't accept this crackhead
53
36
u/winter-ocean Apr 24 '21
I take it this is from an SCP fan game but yeah this is really bad.
19
u/IGambleNull Apr 25 '21
It should be a server plugin for SCP:SL
26
u/Snackomat Apr 25 '21
Atleast supposed to. Thing is: I highly doubt it's working in this state :,)
1
19
629
u/matt1484 if true else false Apr 24 '21
That person takes the sharp out of C#
156
u/Ahajha1177 Apr 25 '21
Cb
72
u/drdrero Apr 25 '21
C minor
54
Apr 25 '21
minor got nothing to with sharpness/flatness
69
5
u/drdrero Apr 25 '21
but it has something to do with a joke
7
Apr 25 '21
Ok, this is Reddit and we're all fucking around but I'll try to explain why it doesn't work as a joke - because this is a weekend and wth. C# means that it's a note higher than C, it's not a type of C. The same note could have been called D but western music blabla. The point is the pitch is higher than C so it works as a 'C# is better than C' joke. (up means 'better' most of the time). So the joke that removing the # from C works, the follow up Cb is also a good joke follow up.
Now C minor is actually 'a type' of C, we can talk about the minor key or the minor scale itself but the point is its rooted in C. It's not "lower" in any sense. Sure I guess if you just think of the word minor it would seem like a weak version of major but unlike pitch there's really no objective measure. It's just a different flavor of C, kinda like juice, you can have grapes or orange flavor but you can't really compare them in an objective scale. Thus saying C minor doesn't really work because C minor is not 'bad' compared to anything. At least with sharpness/flatness we could joke that the higher the pitch the better.
10
u/drdrero Apr 25 '21
A C minor is an underage C programmer, which most likely was the one writing the bad code
3
1
2
Apr 25 '21
Disagree. In a C minor chord, as opposed to a C major chord, the 3rd is lowered (not sure if I say that correctly), and as you said, lower == worse etc. So it still works for me
2
Apr 25 '21
You have a point. I was thinking more of the scale as a whole, because they all end up in the same place with the same number of notes - just the interval between the notes are different. But yea if we're talking basic chords (triads) then you're right about the minor 3rd, good catch.
1
Apr 25 '21
Fair :) I would agree the other joke does work better, this one is indeed a bit farther fetched.
1
u/jaysuchak33 ifelseifelseifelseifelseifelseifelseifelseifelseifelseifelse Apr 27 '21
If you want to get all theoretical about it, let's talk about modes.
There's different types of scales that can be built upon a root, the most commonly used ones are major and minor (ionian and aeolian)
You can go through different modes by chromatically altering one or more notes in the scale, you can also take this to the next level by staying in the same mode but modifying it like melodic and harmonic minor but let's just stick to the pure modes.
If you take a major scale which is the most commonly used one, you can convert it to minor by flattening the 3rd, 6th and 7th note in the scale. Alternatively you could keep the notes the same and change the root so that it's the 6th of the original major scale(this is the relative minor) but in this case we want to keep the root the same. Thus a minor scale is technically "flatter" than a major scale because it has flattened notes(or natural notes instead of sharp ones if we're counting C# as the root).
Definitely not saying that minor scales are worse than major though. In my opinion they're a lot more interesting and spicy compared to vanilla major
1
44
1
u/RyanNerd shameless Apr 25 '21
To make sense of this code I've concluded that the variable
cokeis alias forcocaine.
162
u/MurdoMaclachlan public boolean isInt(int i) { return true; } Apr 24 '21
Image Transcription: Code
using System;
namespace Test
{
class Program
{
static bool Main()
{
int coke = SCP207;
int Dboi = ClassD;
int Scient = Scientist;
int Guard = FacilityGuard;
int Tuto = Tutorial;
int Chaos = ChaosInsurgency;
int NtfL = NtfLieutenant;
int NtfK = NtfCadet;
int NtfS = NtfScientist;
int NtfC = NtfCommander;
int Spec = Spectator;
if (Dboi)
{
coke >= 5;
}
else
{
}
if (Scient)
{
coke >= 5;
}
else
{
}
if (Guard)
{
coke >= 5;
}
else
{
}
if (Chaos)
{
coke >= 5;
}
else
{
}
if (NtfL)
{
coke >= 5;
}
else
{
}
if (NtfK)
{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!
48
128
17
3
u/CaJoKa04 Apr 25 '21
This just reminds me of why i prefer indentated languages over those which use brackets
32
Apr 25 '21
You don't need a single curly bracket in that big chain of ifs
6
u/ososalsosal Apr 25 '21
I feel weird making my c# look like python tho. I only do it if the linter does it
2
u/AestheticalGL Apr 25 '21
Are you from Northwood?
6
u/Snackomat Apr 25 '21
I am affiliated with them, however not an official staff member. We're running one of the largest german community servers.
126
u/mosskin-woast Apr 25 '21
Does the expression coke >= 5 evaluated on its own even do anything??
74
15
Apr 25 '21
In C++ it might, if coke is a macro with side effects, right? Like
#define coke (rand() == 0 ? exit(1) : 1)2
Apr 25 '21
That's a question for the compiler, do they even just scratch out 'useless' statrments like this or still process it.
4
u/spaghettu Apr 25 '21
Not sure about C#, but for most C++ compilers depending on the optimization level things like this should be completely optimized away
1
1
u/RFC793 Apr 25 '21 edited Apr 25 '21
Edit: I missed the type definitions, but if these were not primitive types (such as int), or if we don’t know the type from the context of the snippet:
It could in a language that allows operator overloading such as C# (this code) and C++. But comparison operators should never have side effects. Doesn’t mean crappy code must abide by that rule though.
Imagine overloading the
>=operator to say “if I’m being compared against 5, format the hard drive”.1
u/nati9931 Apr 25 '21
Because it does nothing the Compiler will optimize it out... the Compiler will probably just not compile any of it.
37
33
u/PopularExpulsion Apr 25 '21
This might be the worst code I've ever seen.
27
0
Apr 25 '21
[deleted]
2
u/PopularExpulsion Apr 25 '21
I have (and we all have) written some pretty shitty code when I started, but nothing like this. This is pure illogical nonsense.
32
15
7
7
13
18
u/iovilius_ Apr 25 '21
did yandere dev write this?
2
u/Spynder shameless stealing content to r/YandereTechnique Apr 25 '21
I would have linked r/YandereTechnique, but no, this is just wrong on all levels.
0
u/sneakpeekbot Apr 25 '21
Here's a sneak peek of /r/YandereTechnique using the top posts of all time!
#1: The comment that began it all. | 3 comments
#2: It seems that YanDev got a rival... | 2 comments
#3: Yanderedev intensifies... | 0 commentsI'm a bot, beep boop | Downvote to remove | Contact ^^me | ^^Info | ^^Opt-out
5
4
u/green_kerbal Apr 25 '21
So if something is true it is supposed to check if coke>=5? And then?
8
u/taptrappapalapa Apr 25 '21
What I think the thought process is that since Main is a bool return type then the if statements will return a bool from “coke>=5,” but I’m pretty sure C# requires the “return” keyword to do that
3
Apr 25 '21 edited Apr 25 '21
Correct. Also c# doesn't let you use anything except a boolean as a boolean.
You can't even use nullable booleans as booleans (except by casting).
So those if statements shouldn't even compile.
3
u/HereComesCunty Apr 25 '21
I’m quite sure that ain’t ever compiling. You can’t just if(int), there’s nothing for the if to resolve true or false.
Looks like it was written by a JavaScript dev on crack
3
5
2
2
2
1
1
1
1
1
u/BongarooBizkistico Apr 25 '21
This is evaluating booleans and then doing absolutely nothing with said evaluations? I'm guessing the compiler removes those so the code is literally doing nothing?
1
1
u/Ich_bin_da Apr 25 '21
I dount know c# well, but why the fuck are those integers assigned to a String?!
1
-1
u/AffectionateSimple94 Apr 25 '21
Fail for bad indentation. Also the code doesn't look good.
-4
u/Shakespeare-Bot Apr 25 '21
Fail f'r lacking valor indentation. eke the code doesn't behold valorous
I am a bot and I swapp'd some of thy words with Shakespeare words.
Commands:
!ShakespeareInsult,!fordo,!optout3
0
Apr 25 '21
[deleted]
13
u/SharkLaunch Apr 25 '21
Also, the code in the if blocks aren't even doing anything. The results of the expressions aren't used.
281
u/DiabeticPissingSyrup Apr 24 '21
Wtf is that even supposed to do?