

The person who does not make the correlation between table name and that fact it represents a container. So "user container" can contain multiple rows. The person who makes a correlation between the table name and the fact it represents a container, which can contain multiple rows. We view things from different perspectives, and I think the two camps are identified by: usersHolidaysRemainings or userHolidaysRemainings or.?.You either continue the plural for consistency and have terrible sounding table names, or break consistency: It also breaks when you have various tables that relate to each other with multiple words. Or consistency but with invalid words that would urk most people reading them: So do we have inconsistency, which is annoying to work with: The business advances even further, and now they trade in deer and cod. Should the table be "sheeps" which is incorrect English? It's not even a word.Should the table be "sheep" and break consistency with all the other plural names, like "cows"?.They have a table named "cows" and are to start trading with "sheep". Imagine an agricultural business who has to store data about their animals.

You wouldn't put the word "data" on your table name, but that's what it is, a collection of data with one or multiple rows that is related to "webUser". But you don't actually have "web users" physically in your table, it's just data, so think of it like "webUser data". If you were at a business meeting with 40 of your site users, you'd refer to them as "there's all of our Web users". "Plural" names only sound correct because the tables are thought of as multiple things, "users" etc. The arguments on "plural" seem to be mostly about being grammatically correct, and while we have grammar to some degree in programming it's not the same as the actual English language itself. The English language is not a good and proper programming language, and trying to make database and program statements conform to English because it sounds better to read one of those statements is a mistake.
#ELIXIR ECTO TABLE NAMES PLURAL OR SINGULAR CODE#
There is also a problem with irregular plurals for automatic code generation and programmers who have different language backgrounds or ideas about the formation of plurals in a program. If you then want to identify a collection in the program, you can use a plural, or better, use an appropriate modifier, such as EmployeeList or EmployeeArray. Things work out more logically for object oriented programs that use the data, if the name of a record type (and by extension the table name) is kept singular, as it will correspond with the name of the class you would use to describe one record. If a table was allowed to have a different name than that of the type of record that it contains, you could give the table a plural name, so that you could for example have an Employees table containing multiple Employee records.īut the designer of SQL did not provide for separate names for tables and record types. While a table is a collection of multiple records, a table is named after the definition of the one type of record that it contains. The downside might be that some people might consider it confusing to have both singular and plural used to name directories.Concerning singular versus plural table names, the subject seems to be controversial, but it shouldn't be. In my specific case I would have in the directory for queues modules named requests_queue.ex and responses_queue.ex, both different are two different types of queues, and not components of a queue functionality, therefore I think it would make sense to use the plural form queues for naming the directory( in this specific case). But after reading the names of the modules in these directories I feel that in those cases it makes sense to use the singular form because the modules inside that directory are components of the thing that the directory name refers to( for example in the Elixir Kernel it makes perfect sense to use singular for the kernel directory because all the modules inside are components of it).

I've went to check other elixir projects to see what convention they used( like Phoenix and Elixir) and I've noticed that most directory names are singular. I'm just working on a project where I have several modules that implement supervisors, several modules that implement registries for other modules and several modules that implement queues.īasically I can name the directories queues, registries and supervisors or queue, registry and supervisor(the choice is between plural and singular).
