3 ms·
I always have mixed feelings about using plurals for naming. Pluralization in English is extremely inconsistent. cat -> cats, dog -> dogs, child -> children
by snarfy 6y ago
I always have mixed feelings about using plurals for naming. Pluralization in English is extremely inconsistent.
cat -> cats,
dog -> dogs,
child -> children,
person -> people,
etc.
It makes my code feel inconsistent too. Sometimes I use more specific typing to resolve this, e.g. PersonList , but I'm not sure that's any better.
- dliff 6y agoI've gone back and forth on this in respect to database tables and ultimately prefer singular. If the table is named "profile", I think it's obvious that it can store more than 1 profile, since... well it's a table and has rows.
- adamrt 6y agoAgree. I've always preferred the Django vs the Rails way on this. Django uses pluralization only for display purposes. Things are object_detail (singular) and object_list (plural). It just assumes 'append s' for plural displays, unless you override. I like the _list suffix instead of trying to pluralize
- sidpatil 6y agoI don't see a problem with writing "childs" or "persons". In this scenario, consistency is more useful than grammatical correctness [1]. And the simpler pluralization logic makes it easier for non-English speakers to work with the codebase. [1] Related example: https://en.wikipedia.org/wiki/HTTP_referer#Etymology https://en.wikipedia.org/wiki/HTTP_referer#Etymology