25 lines
977 B
Markdown
25 lines
977 B
Markdown
|
---
|
||
|
title: Be consistent
|
||
|
date: 2024-09-20
|
||
|
permalink: daily/2024/09/20/be-consistent
|
||
|
tags:
|
||
|
- software-development
|
||
|
cta: ~
|
||
|
snippet: |
|
||
|
However you write code, be consistent.
|
||
|
---
|
||
|
|
||
|
Whether you [prefer strict code or not][0], [use snake-case or camel-case for variable names][1] or [how you write your test methods][2], it is important to be consistent in how code is written.
|
||
|
|
||
|
If you're working in a file that uses snake-case variable names, you should do the same and follow the same conventions.
|
||
|
|
||
|
When reading a file, everything should be consistent and seem like it was written by the same person following the same approaches.
|
||
|
|
||
|
Otherwise, when you need to add to or refactor this code in the future, it will be harder to do so.
|
||
|
|
||
|
Consistency is key.
|
||
|
|
||
|
[0]: {{site.url}}/daily/2024/09/19/the-two-ways-of-writing-php-code
|
||
|
[1]: {{site.url}}/archive/2023/04/19/camel-case-or-snake-case-for-drupal-code
|
||
|
[2]: {{site.url}}/archive/2022/11/14/camel-case-or-snake-case-for-test-methods
|