Skip to content

Instantly share code, notes, and snippets.

@vinayvinay
Last active March 26, 2019 13:48
Show Gist options
  • Save vinayvinay/7233420 to your computer and use it in GitHub Desktop.
Save vinayvinay/7233420 to your computer and use it in GitHub Desktop.
Conventions and preferences to be shared within teams to promote harmonious and joyful Ruby on Rails development.

Teamshares

Conventions and preferences to be shared within teams to promote harmonious and joyful Ruby on Rails development.

1. we create 12factor apps

  1. http://12factor.net/

2. we’re designing for humans

  1. norman nielsen’s 10 usability heuristics for user interface design
  2. shneiderman’s eight golden rules of interface design

3. we're also designing for developers

  1. please add enough logging to give your application a voice, use the right Log Severity Level
  2. tame crazy rails logging and also make it ready for log mining - use Lograge
  3. how to write great commit messages https://chris.beams.io/posts/git-commit/#imperative

4. sprint 0

  1. setup source control
  2. setup git hooks
  3. setup ci
  4. setup boxen

5. test conventions

  1. read betterspecs.org
  2. use latest rspec conventions: expect(expectation).to eq()
  3. write tests that check for negative scenarios before happy paths
  4. use only one describe block per spec file
  5. for contexts in model specs, use the name context ".method_name"
  6. for contexts in controller specs, use the name context "http_verb /resource.:format"
  7. sound direct, confident and explicit - f.ex. instead it "should return blah", write it "returns blah"

6. code conventions

  1. all magic strings in translations yml
  2. javascript has to be camel-case

7. git conventions

  1. this captures it pretty well - https://github.com/alphagov/styleguides/blob/master/git.md

8. security, privacy and compliance

  1. use uuids instead of ids
  2. use .iso8601 timestamps

9. performance

  1. process asynchronously all requests that can take longer than 2s, or are making another http request in the background

10. code nitpicks

10.1. for readability
  1. don’t use quotes within strings - use %q() or %Q() instead
  2. use if !(expr) instead of unless (expr), i know many people who suffer from unlessexia
  3. prefer guard statements over if else, wherever possible
  4. prefer case statements over conditionals built around value stored in a variable

11. preferred toolchain

11.1. gems
  1. pagination: kaminari
  2. authentication: devise
  3. asynchronous processing: sidekiq
  4. orm: mongoid
  5. task scheduler: whenever
11.2. products & services
  1. database server: postgres
  2. document store: mongo
  3. search engine: elastic search
  4. ci-server: jenkins
  5. monitoring: nagios
  6. key-value-store: redis
  7. ui framework: twitter bootstrap
  8. ruby server: puma

12. human tendencies

  1. we all are interruptable
  2. if you're new to the team, and no one has yet told you what you're supposed to work on, firstly - 'relax !', then do anything you want related to the project. someone will come and speak to you about what is expected from you.
  3. very often, you might be in a situation where you might want to work on something else that's going on which seems more interesting. no issues. make sure you sign-up accordingly in the next stand-up, try to pair on that story, or if you can't get it working your way, let your friendly tech-lead or PM know about it. we'll try and do something about it.

13. Good reads

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