DEV Community


A little rant on naming things

voins profile image Alexey Voinov ・1 min read

Oh, how I'd love to forbid usage of info, data, and context in variable and class names. Looks like everybody is using it without understanding what they really means. Who's able to tell the difference between accountData, accountInfo and just account? Especially if they're in the same method. Or maybe what the hell is 'fieldContext' if that's the property of the field, and not something defining environment, where the field is used (or evaluated). Or maybe difference between three classes all named SearchContext, with nothing in common. And yes, they're all used in the same project and sometimes even in the same packages.

One other thing I like so much about naming: it is handle or process in the method names. Especially when this method is several hundred lines long. For me it is just like the giant sign above the method: "I don't know the hell what this method does or should do. Sincerely yours. Author."

Sorry, I think I need to go try some Vulcan meditation techniques now.


Editor guide