Skip to content

Instantly share code, notes, and snippets.

@jeremyjs
Forked from Atrus7/Coding Rules.markdown
Last active August 29, 2015 14:05
Show Gist options
  • Save jeremyjs/cd65e4fe53ca0d6a7dd5 to your computer and use it in GitHub Desktop.
Save jeremyjs/cd65e4fe53ca0d6a7dd5 to your computer and use it in GitHub Desktop.

CONSTANT_NAME variable_name ClassName functionName

  1. Naming things is cheap--have DESCRIPTIVE NAMES. It should read as close to natural language as possible, avoiding abbrevs. and in-house language when possible.

  2. Functions should have one thing they do. Endeavor to have pure functions, so that they do not have side effects. Functions should be have a maximum of three arguments. Good functions have one or two.

  3. Avoid being clever and implicit whenever possible.

  4. Like this sentence //Comment only when it's not clear what you're talking about

  5. Don't rebuild the wheel unless the wheel is a box made of rubber. Then reinvent and open-source that sucker.

  6. Classes can be simple. Don't build a monolith if three tiny types will do.

  7. Git commits are like bookmarks. Great to find stuff, but too many, too often, makes them less useful. // not sure on this one

  8. Avoid flags whenever possible

  9. Build first, then re-factor. DON'T FORGET TO REFACTOR.

  10. Bracket spacing

function andClassesToo()
{
  if-controls() {
  
  }
  loops() {
  
  }
}
@Atrus7
Copy link

Atrus7 commented Sep 2, 2014

Cool, I like your revision. Yeah, #7 is a little controversial. My view on it is that git commits are great for finding things. Great for when you want to revert to a previous code-state, find a specific change, etc. Thus, if commits are too frequent, then it takes longer to find what you want. I could be misguided though

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