Adopt naming conventions for everything not just functions

This is part of the Semicolon&Sons Code Diary - consisting of lessons learned on the job. You're in the naming category.

Last Updated: 2024-12-03

Consider naming conventions not just for functions, but for every string (nay: every THING) in a project.

In a code base for Laravel (which uses camelCase for function names), I added factories for test data. The state attribute was a string and "since it wasn't a function" I didn't think about making it consistent and therefore absent-mindedly went with snake case: php <?php factory(User)->state('partially_filled');

This inconsistency ended up being confusing. I should have paused when facing the need to add a space and weighed up the pros and cons of each way of doing it, then establishing a rule.