Hacker News new | past | comments | ask | show | jobs | submit login

>- don't choose lazy pluralization - eg instead of `names/name`, use `nameList/nameItem`

Isn't this just extra noise? If the type of the variable is an Array wouldn't `nameArray` be superfluous? Worse still is if the type changes but the name stays the same.

I get the advice is probably Javascript specific, but even in a Typescript world it doesn't make much sense to me to do this kind of type-in-name encoding.




Even in typed languages `names` and `name` are too similar to slow code reading down.


Exactly this. In many languages the compiler will help you.

But this has bitten me in Ruby, JavaScript and PHP several times. Runtime errors and downtime. Most recent: autocompled some updatedCartsItems when it had to be UpdatedCartItems. Both were used in the same class. Had they be named sensible, like CartListWithUpdatedItems and UpdatedItemList or something better, I'd have saved myself hours of WTFing through CI logs.


Disagree, but in that case wouldn't `nameList` and `name` be best?




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: