Skip to content

Instantly share code, notes, and snippets.

@webbower
Last active June 5, 2023 18:38
Show Gist options
  • Save webbower/4c240a649afa88f4bde5c869e1379764 to your computer and use it in GitHub Desktop.
Save webbower/4c240a649afa88f4bde5c869e1379764 to your computer and use it in GitHub Desktop.
General Coding Guidelines

Naming Guidelines

There are only two hard things in Computer Science: cache invalidation and naming things.

-- Phil Karlton

Variable Names

  • Data should be nouns/things

Boolean Variables

  • Prefixes: is, can, has, does, should

Function Names

  • Functions should be verb/actions
  • Keywords: fetch, load, get, set

Namespaces

Implementation vs Interface

Program to an interface, not an implementation.

-- Design Patterns by the Gang of Four

  • Including the name of an underlying service, library, or external product name should be avoided unless you are writing code to transition from one underlying implementation to another.

React-Specific

Event Handlers

  • on[Qualifier]<Event>, handle[Qualifier]<Event>

Higher Order Components

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment