DEV Community

Discussion on: No to Imperative Code! Because Debugging Spaghetti is No Fun

 
noriller profile image
Bruno Noriller

I don't agree because it should never be set on stone.

"Max" is pretty descriptive even if you don't use "maximum", inside that scope it's ok. Wouldn't be true if "m" were used.

However, in this example:

const productsIds = products.map(p => p.id)
Enter fullscreen mode Exit fullscreen mode

I would say one letter is the correct choice, since:

const productsIds = products.map(product => product.id)
Enter fullscreen mode Exit fullscreen mode

Having no abbreviations actually hurt how to read and generate just extra clutter.

My rule of thumb is to have the name length inversely proportional to the scope.

A dozens of lines function calls for bigger, descriptive names.
A one liner? Maybe one letter is enough.

Thread Thread
 
mcsee profile image
Maxi Contieri

'My rule of thumb is to have the name length inversely proportional to the scope'

It is fine.