Serious development is done by many different people. We have to start agreeing.
TL;DR: Don't mix different case conversions
Problems
Readability
Maintainability
Solutions
Choose a case standard
Hold on to it
Context
When different people make software together they might have personal or cultural differences.
Some prefer camelCase🐫, others snake_case🐍, MACRO_CASE🗣️, and many others.
Code should be straightforward and readable.
Sample Code
Wrong
{
"id": 2,
"userId": 666,
"accountNumber": "12345-12345-12345",
"UPDATED_AT": "2022-01-07T02:23:41.305Z",
"created_at": "2019-01-07T02:23:41.305Z",
"deleted at": "2022-01-07T02:23:41.305Z"
}
Right
{
"id": 2,
"userId": 666,
"accountNumber": "12345-12345-12345",
"updatedAt": "2022-01-07T02:23:41.305Z",
"createdAt": "2019-01-07T02:23:41.305Z",
"deletedAt": "2022-01-07T02:23:41.305Z"
// This doesn't mean THIS standard is the right one
}
Detection
[X] Automatic
We can tell our linters about our company's broad naming standards and enforce them.
Whenever new people arrive at the organization, an automated test should politely ask him/her/.. to change the code.
Exceptions
Whenever we need to interact with out of our scope code, we should use the client's standards, not ours.
Tags
- Naming
Conclusion
Dealing with standards is easy.
We need to enforce them.
Relations
![mcsee](https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F366059%2F1d8942bc-727d-4d1e-bc50-30ff073a34fc.jpeg)
Code Smell 48 - Code Without Standards
Maxi Contieri ・ Dec 10 '20
More Info
![mcsee](https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F366059%2F1d8942bc-727d-4d1e-bc50-30ff073a34fc.jpeg)
What exactly is a name? — Part I: The Quest
Maxi Contieri ・ Feb 9 '21
Disclaimer
Code Smells are just my opinion.
Credits
Photo by Wolfgang Hasselmann on Unsplash
If you have too many special cases, you are doing it wrong.
Craig Zerouni
![mcsee](https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F366059%2F1d8942bc-727d-4d1e-bc50-30ff073a34fc.jpeg)
Software Engineering Great Quotes
Maxi Contieri ・ Dec 28 '20
This article is part of the CodeSmell Series.
Top comments (0)