We all know that naming things takes more time than coding. Here are the ten worst common names to give to your files, variables, classes…
Let’s start:
- “new”. If you are doing a refactoring, today you are making a “new” template. But this will sound pretty ridiculous in five years.
- “old”. 100% of the time, when you call something “old” it means you should just trash it.
- “data”. Ok, it’s clear that we’re talking about “data” and not broccoli, you’re not telling me anything new about the content of that variable.
- “clean”. This drives me crazy. All you can tell me about your file is that it’s “clean”?? You should talk to a psychologist about it.
- “something1” or “something2”. I bet you will need a “something1-A” soon. Same goes for “first” and “second”
- “manageResponse()”. I always used this in the beginning (and when I’m desperate I still do it). What exactly will we do with this response?
- “custom”. This means nothing. Custom compared to what??
- “somethingOK”. I’m glad you are happy about your work, but there’s bound to be a “somethingKO” somewhere
- “x”. Or any other single letter. We all are lazy, but this is too much.
- “last” You bloody optimistic. You will regret it bitterly
Jokes aside, it’s important to choose names that have a clear, simple and unambiguous meaning. If that’s not possible, maybe something is wrong. But not in the name, right in the code!