DEV Community

Why Are Coding Standards Important?

George Hanson on April 18, 2019

Almost every language has a set of standards that developers advocate. Off the top of my head and coming from a PHP background, PSR standards sprin...
Collapse
 
matthew_collison profile image
Matthew Collison

Code standards that follow the community agreed guidelines (e.g. PSR in PHP or Google's JS style guide) are the sign of an excellent programmer.

People have any number of objections like the fact they have their own style, or they have a personal preference, but it's very short sighted because chances are your code will be picked up by someone else in the future. And when it is, if it is consistent with community guidelines, you save a million headaches for that other developer.

So spend the 2 weeks it takes to research community standards and adopt them - your peers will appreciate it. Unless your code will never see the light of day outside your own eyes!

Collapse
 
ferricoxide profile image
Thomas H Jones II

Coding standards also help with ensuring that code-linters work ...and, by extension, that your code is mostly going to do what you think it's going to do - whether under conditions you expected or didn't.

That said, some of the standards feel like they make it like a lot of a given programmer's "personality" is washed away.

Collapse
 
ronancodes profile image
Ronan Connolly 🛠

Having consistent code formatting matters.

Imagine reading a book where the fontface, font color, font size, and line indentation was different on every paragraph.

It would be difficult to read, and incredibly difficult to update (maintain) and find typos (bugs).

Collapse
 
jessekphillips profile image
Jesse Phillips

I have a standard for you. Don't commit formatting changes.

Seriously many of the standard conventions I see come because people have a hard time reading one style or another, and I suppose mixed style. These types of coding standards suck for me because I literally don't even see them. And I don't want to train myself to see them.

Collapse
 
devit951 profile image
Ildarov

Yeah, I use java standards as much, as possible.

Collapse
 
ronancodes profile image
Ronan Connolly 🛠 • Edited

I use the Angular and TypeScript standards.
Best to go for what the language/framework you're using recommends.