How do you go about naming things? I struggle with this. Especially when it comes to frontend design. I use mostly BEM style naming, but I find things to be too verbose sometimes, slowing down productivity and readability. Often times the first tool I grab off my shelf is a thesaurus.
Do you struggle with naming things, or have methods for handling this? I find what is most helpful is to use an analogy with a well defined hierarchial taxonomy. For instance:
- A stick figure has a head, a body, feet, arms - much like the DOM has a header, body, footer, and asides. Arms have fingers, feet has toes, much like there are footer links and aside widgets.
These examples could be either found in nature or just well established in society. What I am looking for is taxonomy hierarchial examples that could be used in any application, that aren't namespaced already. Examples for class inheritance is (animal → dog).
------------------------------------------------------------------
Other applications relative to naming:
- CSS classes, and their hierarchial relationships
- Designing a CSS framework & its naming conventions
- Functions, variables, classes, etc for frontend or backend
- Defining different UX webcomponent names and their hierarchial relationships
- Defining keyword definitions document for larger projects, both from the users & developers standpoint
- Designing endpoint documentation for REST API's
- Writing technical documentation with actual relateable examples (without using the word foo or bar)
------------------------------------------------------------------
What are examples you use?
Do you use these principles in your codebase?
Name things based on their intent in a given context.
If you're having trouble with names, you're very likely in one of 2 camps -
1) You're trying to shoehorn your objects into a specific naming convention.
2) You don't have a clear idea what the intent of your object is.
In any case, the best solution is to simplify - as simple as possible for its given context, and no simpler.
Trying to force a hierarchy or taxonomy of names across a given project is just going to confuse things. Your names won't be organic representations of your objects, and you'll have trouble down the line.
If a thing is a type of another thing, those naming conventions are fine, but don't force it.
Give things fitting names, don't fit them into names.