DEV Community

Cover image for Naming Anti-patterns
Rasmus Larsson
Rasmus Larsson

Posted on

Naming Anti-patterns

Naming is hard

Smell Why Prefer
"Date" Just "date" without a context does not help understanding when reading the code. Prefer using a preposition together with some context such as "HappenedAt", "UpdatedOn", "AllowedAfter"
Just "in/out" or as prefix/suffix These are easy to mix up but don't require a source/target which often results in ambiguity.
Example: directories called /files/in and /files/out, this doesn't tell you in or out from where.
If you use "to/from", they require a source/target which should give more clarity.
Example: /files/from_remote_server and /files/to_remote_server

Do you have any naming anti-patterns you'd like to share? Please do!

Credits:

Top comments (0)