The Rails Beatitudes
There is a great gist called “Note to Self” which was, I think, originally started by John Barnette (jbarnette on Twitter and GitHub). I am sharing it here as I thought it was pretty interesting. I added links below to more information, where applicable, and renamed it The Rails Beatitudes since each principle starts with Be.
Tests build confidence. Write ‘em. They’ll save your ass, and they’ll let you take a chainsaw to your code without being afraid of unintended consequences.
- RailsTips articles on testing
- Peepcode has multiple screencasts on testing: test first, RSpec basics, mocks and models, and controllers and tools
- Railscasts testing controllers with RSpec
If it’s happened more than twice, don’t ever do it by hand again.
If there’s a lifecycle, model it as a real state machine. Beware ad hoc flags.
You’ll write it once, but you’ll read it a lot. Code accordingly. Sometimes simplicity takes a bit longer, but it’ll pay off.
Inconsistent file names, task names, or coding conventions hurt productivity.
Be Timely (but not too timely)
Keep frameworks, plugins, libraries, and tools up-to-date, but think twice before using a production app to play with the bleeding edge.
Don’t speculate, get data. Act on what you know, not what you suspect. Is that code really faster? Do users really want that feature?
Find the root cause. Keep asking why, even when you’re tired and under the gun. The guesswork patch you write today will be a nightmare tomorrow.
If it’s not working, change it, no matter how long it took to write. Don’t throw good money after bad. Admit mistakes early and often.
In one of the forks of this, Evan Phoenix added one more be to the list:
Be Aggressive! Be Be Aggressive!
By a cheerleader for yourself AND others on your team. A positive attitude goes a long way in making people productive.
I think these are some great principles for developing in any language, but are particularly well suited for Ruby and Rails. Anyone have additions that are well suited for the list?