DEV Community

Discussion on: What are your personal stories/examples of "naming things"?

Collapse
 
fnh profile image
Fabian Holzer • Edited

I do have a pet peeve with abbreviations - for me they tend to drain the concentration I would much rather use on my actual work.

For example, I recently saw "cd" as a variable name, I was able to guess it correctly in the context (change detection), but well, I used the same API just the day before in another project. But I cd to change directory, and still have a nice collection of compact disks, and I had a context definition not so long ago - you see where this leads.

It is a sign of lazyness and not caring about anyone else who might read the code you write. Also, at least if a decent type system and a reasonable IDE is at hand, you don't even save so many key strokes.

What I sometimes actually do - usually in early stages - is to name things I have a hard time finding a really good name for in an manner that pains me while reading - as a marker to not let something so generic that it becomes meaningless or obscure be checked in. So if you pass my screen you might see something of type BlablaEntityIReallyShouldMakeMyMindUpAbout. ;)

I've also done this with a build task once. I had spend half a workday desperately trying out things and in the end it worked and I had a hard time understanding why, so gulp ran for the next two month a task called something like "compile:horrible-horrible-workaround-which-makes-me-question-my-career-decisions".

Generally speaking, I try to avoid making a mess in the first place. ;)