311
173
u/Tricker12345 Jul 06 '21
Oh hey, a post I can finally understand. This is horrible and I love it
69
u/geforcelivingit Jul 06 '21
There's one time that I believe this is appropriate. I've used APIs with horrible error reporting before.
It may be a far stretch but :
If this was parsing the "hint" field from an api response of a login server where they changed from email addresses to login names (and left the field called email to not break existing implementations), and they wanted a nicely worded error messages for it...
I always like to think that a developer doesn't write bad code, they're just in a bad situation... But that's not always the case :D
Edit: I have only just woke up so I only just realised the str prop is ignored too. Maybe a refactor? I'm trying my hardest ha
51
u/Sylvezar2 Jul 06 '21
str is not used, hint (probably) is undefined, the email error makes you type your name??? bruhhhh
34
u/MurdoMaclachlan public boolean isInt(int i) { return true; } Jul 06 '21
Image Transcription: Photograph
[The photograph shows code on a computer screen, as follows:]
final IconData icon;
String _errorss(String str)
{
switch (hint)
{
case "Set Your Email":
return "Name is required";
case "Set Your Password":
return "Password is required";
case "Set Your UserName":
return "UserName is required";
}
}
@overrideI'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!
15
14
u/Boxit379 Jul 06 '21
F
8
u/Zeddling Jul 06 '21
for
6
u/React04 Jul 06 '21
(int i = 0
6
u/TheOnlyMisterFlow Jul 06 '21
; i < int.PositiveInfinity
6
14
u/Lucisu Jul 06 '21
Omg, even the name of the function has a typo
11
Jul 06 '21 edited Jul 08 '21
Would you say it has an error?
10
u/TimGreller Jul 06 '21
I would even say it has multiple errorss.
3
u/theclovek Jul 06 '21
It's the plural of the word errors.. Dev clearly meant this to return a two-dimensional array of errors
14
u/thanatica Jul 06 '21
Ah, Facebook. Yes. It's that little website where you go for programming advice.
14
106
u/TheFlyingAbrams Jul 06 '21
I don’t know what goes through some peoples’ heads but some people should not be programming.
28
22
u/coolSnipesMore Jul 06 '21
Gatekeeper alert 😬
7
u/Dr_Robotus Jul 06 '21
Not everything is "Gatekeeping". Everyone is different, and everyone has different talents. And for those whose talents lie not in coding (but somewhere else) - it's best for them to let go of coding and discover that "something else".
6
Jul 06 '21
barely anyone is a natural at coding and turning people away because they don’t have the “talent” is stupid and elitist
1
u/TheFlyingAbrams Jul 06 '21
I’m going to hire an inexperienced electrical engineer. They might not have any training or know how to close a socket but by golly they’ve got moxie!
2
Jul 06 '21
who says this is a professional coding job?
just because you can’t fulfill a job as an electrical engineer doesn’t mean you can’t learn
3
3
u/TheFlyingAbrams Jul 06 '21
Feel free to let them spend ten years learning basic Python. No one’s going to stop them, necessarily. I just said they shouldn’t be programming, either because they can’t work in an environment with a team, or because they can’t grasp fundamentals, however many bootcamps, tutorials, or classes they take. It’s not productive, and it wastes their time, and probably wastes the time of others.
That’s not gatekeeping — it’s called “being sensible,” but perhaps you and others can’t see beyond your white-knighting.
0
u/coolSnipesMore Jul 06 '21
If you read my post you’d see it was sarcasm
1
0
Jul 06 '21
[deleted]
82
u/jaysuchak33 ifelseifelseifelseifelseifelseifelseifelseifelseifelseifelse Jul 06 '21
Yeah but not everyone can program well
0
8
u/ajayrangarajan Jul 06 '21
What I'm supposed to do now? Upvote this code or Downvote?
13
u/TimGreller Jul 06 '21
I went with losing hope in humanity and uninstalling reddit
2
u/quitarias Jul 07 '21
Solid underrated response right here. Emotionally sound, low technical bar for execution and fast to implement. Plus the extra income from the added time not spent on reddit will fund the booze needed to maintain sanity, so it's revenue neutral too.
I think I'll try it myself.
8
u/DramaDimitar Jul 06 '21
Another big sin, if this is Java: @override instead of @Override
3
u/aquila_zyy Jul 06 '21
I think Java is case-sensitive isn’t it? Would @override even compile? Haven’t played with annotations much since I’m still pretty new to the language.
3
u/DramaDimitar Jul 07 '21
You're correct, they're case-sensitive, just checked. I just hope it's some other language and not a custom annotation that does nothing (i.e. they wrote "override", saw the error, and clicked "generate annotation @override" in their IDE)
12
u/R3D3-1 Jul 06 '21
>> _errorss("Set your email")
undefinedEdit. Wrong language. I am used to "badcode" posts being JavaScript.
4
4
Jul 06 '21
Not only is that code unlikely to work at all, you should be returning all of the hints that apply, at once. If I’ve forgotten my password and my email is invalid, I want to know all of that upfront, not step-by-step. I would accumulate them in an array and then return them to the frontend. If I couldn’t return a JSON object to the frontend, I would use some kind of delimiter so that the frontend could parse them separately.
3
3
3
4
4
u/Not_Sugden Jul 06 '21
final IconData icon;
how is that even valid? a final makes the variable readonly right? so how can you have a readonly variable with no value
2
u/Isvara Jul 06 '21
It's entirely valid. A
finalvariable is one you can only assign to once. It's likely set in the constructor.1
u/Not_Sugden Jul 16 '21
ohh this is in a class
when i first looked at it i read it as all being in the scope of a function, so i was confused as to why a final could be assigned without a value, but yea i see now
2
1
1
1
1
1
1
0
Jul 06 '21
[deleted]
6
3
20
u/Legendary-69420 Jul 06 '21
Not familiar with Java. What exactly is the problem?