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
-
Some people do that style of empty if to make later refactoring obvious. I don't agree, but I've seen it before.
-
codedoge6008yI find it hard to classify the above as "clean" when the following would have done the same thing:
if (!dict.ContainsKey(key)
{
dict.Add(key, value);
}
The comment is useless, the if statmeent is renundant and it uses twice as many lines. -
codedoge6008y@codedoge if you can't get a simple if-else statement right, what should I excpect for problems requiring more complex solutions? -
codedoge6008y@okkimus I prefer to use different styles depending on the popular conventions of the language -
codedoge6008y@okkimus I find C# code with opening bracket on the same line just as ugly as I would find curlies on new lines when I read JS -
codedoge6008y@Jonnyforgotten Meh, It's just the last thing in a long line of ridiculous code snippets I've been stumbling upon in the project. -
codedoge6008y@Jonnyforgotten What irritates it's me is that the cleaner solution is even easier and more compact to write -
tkdmatze4388yOf course the comment should be
// NOP
https://en.wikipedia.org/wiki/NOP
seen it often enough in my career, some companies refuse the not-operator in if clauses because it can be "overseen" that quickly
Related Rants
-
linuxxx32*client calls in* Me: good morning, how can I help you? Client: my ip is blocked, could you unblock it for m... -
DRSDavidSoft30
Found this in our codebase, apparently one of my co-workers had written this -
linuxxx24*client calls* "hello, we forgot the password to our WiFi router. Could you reset that for us?" 😐😶😮...

Actual code
if (dict.ContainsKey(key))
{
//do nothing
}
else
{
dict.Add(key, value);
}
I'm speechless
undefined
wtf