Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Ruby On Rails coding conventions, standards and best practices

Ruby On Rails coding conventions, standards and best practices

David Paluy

August 22, 2012
Tweet

More Decks by David Paluy

Other Decks in How-to & DIY

Transcript

  1. Philosophy (from Rails) • DRY – Don't Repeat Yourself •

    Convention over Configuration • YAGNI - You ain't gonna need it
  2. Source code Style • Two spaces, no tabs • Boolean

    tests: don't use “and” and “or”, always use “&&” and “| |”
  3. Go Easy on the Comments • If it's obvious –

    don't explain it • Remove old commented code • “How to” comments
  4. Camels for Classes, Snakes Everywhere Else • “Snake case”: lowercasse_words_separated_by_underscore

    • “Camel case”: ClassName good Class_name bad • Constants: (my own preference) ALL_UPPERCASE = true
  5. Git the diff says what you did; your commit message

    should tell me why you did this