Coding standard deviations
Maciej Łebkowski
Posted on August 24, 2020
I’m past my times when I wanted to tweak my projects’ code style. Now I simply conform to one of two standards: either Symfony or PSR. Since the purpose of a coding standard is primarily to be consistent, and readable second, I’d rather keep that consistency across projects (and even open source libraries, vendors, etc), than to bikeshed about little details that nobody can prove would make any real difference.
That said, I do like to deviate some times.
First and most important:
This space right there, after the fn
keyword. I mean, how is not mandated by the parser? Important things out of the way, we can move on.
Test cases have long and descriptive names so they are self describing and readable. Let’s take this a little further by sprinkling some magic dust over our names:
Ain’t that better? Once it passes code review at least. And if it doesn’t, I can provide you with a smudge
/clean
git filter. It’s especially useful if your team can’t conform to this great addition. See the attached gist: camelCase_to_piss off your teammates case.sh
😉
Last but not least, let’s make those dates stand out a bit.
I agree that it’s a little hard to type, but code completion will lend a helping hand, my friend… Well, on the second thought, not for one-letter symbols. 😦
Maybe I just need to force push directly to master, to avoid code review? 🤔
„Coding standard deviations” was written on 2020-08-24 by Maciej Łebkowski, and was first published at lebkowski.name. It’s licensed CC-BY-SA.
Posted on August 24, 2020
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.