Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
Bit harsh, maybe. They just need their code reviewed and educated on how to be brief.
-
There's also those people who first create a separate variable to return after the if statement
For no reason whatsoever -
I personally do something like this
if (statement)
return 1;
return 0;
But I had a professor that liked it with an else for readability. He was a pain -
That's not so bad... What's worse is stuff like this:
List<String> list = new ArrayList<>();
String v1 = "something";
String v2 = "something else";
list.add(v1);
list.add(v2); -
You wouldn't believe, how many people in my company do that. And all that code is pushed cleaning this. Thank God GoLint tells you when you're using useless else statements.
-
we use linters here for noobs. its like the first task in the CI so the build fails without even getting to the tests and build phase
-
JS96185258yIt could be worse...
if (count >= 0) { return true; }
else if (count < 0) { return false; } -
nuts6838yI often saw this from unskilled developers:
if(count($array) > 0){ ... }
when it could just be
if($array) { ... }
Related Rants
Developers who writes something similar
if (count >= 0) { return true; }
else { return false; }
deserves a special room in hell.
undefined
rant