Skip to content

Latest commit

 

History

History
23 lines (15 loc) · 968 Bytes

3.3-code.md

File metadata and controls

23 lines (15 loc) · 968 Bytes

Start generic, narrow to specific

By starting our names with generic ideas and narrowing to more specific, it's easier to add adjacent code and ideas that follow the same pattern.

  • nfd-bluehost-widget-account > bluehost-account-widget
  • nfd-module-data-helper-admin > data-module-admin-helper

Prefer specific to vague

Specificity creates a natural growth path without needing to rename/rekey overly-generic keys.

  • nf_account_data > nf_account
  • nf_plugin_updates_cache over nf_plugins

Use singular equivalent to plural in loops

By using the singular variant of a plural, it becomes clear what comes from what. It's also preferred to avoid using data types as names -- please put those in documentation.

❌ Avoid ✅ Preferred
for post in items for post in posts
for single in posts for post in posts
for object in objects for user in users