DEV Community

Cover image for Code Pet Peeves: What's Yours?
dev.to staff for The DEV Team

Posted on

Code Pet Peeves: What's Yours?

Welcome to Code Chatter, your go-to series for conversational coding insights. What makes this series of questions different from all the others? Well, truth be told, not much, but they're still thought-provoking and fun. Join us as we explore the coding world, one witty question at a time.

What's your secret 'code pet peeve' that, while not critical, drives you crazy?

Follow the DEVteam for more discussions and online camaraderie!

Latest comments (36)

Collapse
 
wraith profile image
Jake Lundberg

I have 3 that really get to me:

  1. inconsistent code formatting. i’m fine adopting different patterns or standards, but that pattern should be consistent throughout the codebase.

  2. when someone says “we’ll circle back and fix this later”…in my experience…no we won’t. unless this is a prototype and the team understands that this code will be thrown away, let’s do it correctly now.

  3. duplicate code. it may be easier for you in the moment to copy a chunk of code to get something working, but it causes so much more pain later. invest a little time now rather having to pay interest on that time later.

Collapse
 
pxlmastrxd profile image
Pxlmastr
function curlybracesshouldbelikethis() {

}

function notthis()
{

}
Enter fullscreen mode Exit fullscreen mode
Collapse
 
amarondev profile image
Amar Gupta

👏😁

Collapse
 
drewknab profile image
Drew Knab

Exceptions-as-control-flow, few things get me upset faster.

Collapse
 
kaamkiya profile image
Kaamkiya

No comments, and when (in Python), not all of the import statements are at the top.

Collapse
 
ksolomon profile image
Keith Solomon

It’s code-ish, but I ran into this doing a review with one of our juniors today. She was working on the mobile side of a site, and had the hamburger menu on the left…that’s not a problem. The problem is, the menu opened from the right. It’s so minor as to be pointless, but it drives me crazy to see that…

Collapse
 
nicolus profile image
Nicolas Bailly

Well to be fair if the spec she was given didn't specify what the hamburger button was supposed to do, she could have made it randomly open at the top/bottom/left/right and it would have been just as correct 😉

Collapse
 
ksolomon profile image
Keith Solomon

She wasn’t give a spec for it, and I didn’t say anything about it…I suffered in silence… 😂

Collapse
 
manchicken profile image
Mike Stemle

My pet peeve is folks having too strong of an opinion about syntax.

  • Spaces or tabs? I’m bored.
  • Semicolons or not? Yawn.

I’m also rather annoyed by the over-emphasis on OOP as though it is the only correct paradigm.

Finally, I don’t like folks who behave like one language is better than another. They’re tools, not political positions.

Collapse
 
taikedz profile image
Tai Kedzierski • Edited

Long, long functions. More than 2 levels of loop nesting. More than 2 levels of conditionals nesting.

Not splitting long functions is like writing an email without paragraphs.

🪓

Collapse
 
thumbone profile image
Bernd Wechner

Line length limit standards predicated on screens narrower than the narrowest screens we have today (not moved with the times). Aka PEP8.

Collapse
 
neilb_92 profile image
Neil B

Upper-case SQL keywords. It looks like someone's crazy uncle sent out another email forward and the illegibility gives me a headache.

Collapse
 
peterwitham profile image
Peter Witham

For me, it's over optimizing code to the point that whilst short and elegant, it is not readable at a glance for those that might not live in the code base every day.

Collapse
 
sattineez profile image
Sattineez_SSC

Well, I guess mine it's why some languages start counting with 1, when the rest starts with 0 ( elements of lists for exemple) , why do they want to be different of the rest and don't start with the 0 😅

Collapse
 
cgarofalo profile image
Christina Garofalo

Using long array in PHP. The sea of parenthesis () is so hard to read.

Collapse
 
mikeatupside profile image
Mike Lowe • Edited

Not strictly code but I tend to alphabetise things like environment variables in config files, YAML, JSON param files for CloudFormation, that sort of thing. It pains my heart when someone comes along and just throws new variables/params in in any old order 😭

Collapse
 
nicolus profile image
Nicolas Bailly

Oooh, you would love working with me : I tend to rearrange variable declaration blocks to order them by line length so it looks nice.

Collapse
 
ranggakd profile image
Retiago Drago

Cannot be consistent with either this

def add(a, b, c):
    return a + b + c

add(a_very_long_variable_a,
    a_very_long_variable_b,
    a_very_long_variable_c)
Enter fullscreen mode Exit fullscreen mode

or this

def add(a, b, c):
    return a + b + c

add(
    a_very_long_variable_a,
    a_very_long_variable_b,
    a_very_long_variable_c
)
Enter fullscreen mode Exit fullscreen mode
Collapse
 
khairunnisaas profile image
Khairunnisaas

bottom one is much better for me

Collapse
 
alteredoxide profile image
AlteredOxide

Yes. The first one irks me, especially because that first argument is rarely perfectly aligned with your chosen indentation (2, 3 or 4 spaces), which leads to needlessly tedious manual spaces or deletions before following arguments—depending, ofc, on your linter.

Collapse
 
ranggakd profile image
Retiago Drago

sometimes the former saves more space 😭