(still in draft)

  1. REST API pluralization
  2. Empty but valid REST API responses
  3. Using enums + arrays in databases.

Should REST API resources be pluralized?


On Database Table Names…

  1. Use snake_case for your table names. e.g. Yes: user_privilege No: userPrivilege No: UserPrivilege No: User.
  2. Use the singular form of words to name your tables. Yes: user No: users

If you’re using a database engine that follows the ANSI SQL standard (Postgres, MySQL, and most other RDBMS) use snake_case for your tables and your columns. The standard (source pending) indicates that all table and column names are folded into lowercase. Thus, table names like UserPrivileges that use pascal case or even userPrivileges are folded down into userpriviliges. This ultimately leads to very annoying bugs where queries and DDLs must be written while handling cases by quoting them. Particularly because single quotes and double quotes have different meanings to many SQL engines.

There’s an argument to be made if you’re using a “batteries included” framework like rails.