Lock in $30 Savings on PRO—Offer Ends Soon! ⏳
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Ruby On Rails coding conventions, standards and...
Search
David Paluy
August 22, 2012
How-to & DIY
1
1.4k
Ruby On Rails coding conventions, standards and best practices
David Paluy
August 22, 2012
Tweet
Share
More Decks by David Paluy
See All by David Paluy
Tools to help you better understand the code
dpaluy
0
130
Debugging and Profiling Rails App
dpaluy
3
230
Faster on Rails
dpaluy
2
210
How to Prepare 3 min Fundraising Presentation
dpaluy
0
980
Other Decks in How-to & DIY
See All in How-to & DIY
アイデアをカタチにする、イマジニア
haruka_imgr
0
170
2025版 鯖落ちパーツで安価に機械学習用マシンを作ってみる
bobfromjapan
0
400
スマートハウスの蓄電性能の効率化を実現してみた~電気自動車編~
runrunsan
0
330
[電子工作]クリップモーターをつくろう
oriontakemura
1
460
JAWS-UG 福岡 in 北九州 | JAWS-UG/AWSコミュニティ プログラムのご紹介
awsjcpm
1
170
ATOMS3R-CAMとClaude SKILLSでタイムラプスチャレンジ #iotlt
n0bisuke2
0
180
バーチャルバナナとリアルバナナ #iotlt #TouchDesigner
n0bisuke2
0
200
5年間ぐらい、 スプリントレトロスペクティブは、 「+/Δ」しかしてないので、 あらためて良いのか悪いか考えてみる / Doing Plus Delta for about five years
camel_404
1
270
ラズパイカメラ向け ケーブル延長基板・ハウジングの開発
koheimasaki
PRO
2
400
「無理」を「コントロール」するスキル / Skills to Control "Muri"
hageyahhoo
5
3.5k
個人制作コンテンツの多言語展開のノウハウを全公開! 〜世界に自分を発信しよう!〜
syotasasaki593876
0
120
いぬぬウォッチャー - オレトク賞オンライン決勝 #ヒーローズリーグ
n0bisuke2
0
270
Featured
See All Featured
Faster Mobile Websites
deanohume
310
31k
Keith and Marios Guide to Fast Websites
keithpitt
413
23k
Writing Fast Ruby
sferik
630
62k
Intergalactic Javascript Robots from Outer Space
tanoku
273
27k
Reflections from 52 weeks, 52 projects
jeffersonlam
355
21k
Rails Girls Zürich Keynote
gr2m
95
14k
Making the Leap to Tech Lead
cromwellryan
135
9.7k
Designing for humans not robots
tammielis
254
26k
Thoughts on Productivity
jonyablonski
73
5k
Agile that works and the tools we love
rasmusluckow
331
21k
Producing Creativity
orderedlist
PRO
348
40k
Mobile First: as difficult as doing things right
swwweet
225
10k
Transcript
Ruby On Rails coding conventions, standards and best practices David
Paluy August 2012
Philosophy (from Rails) • DRY – Don't Repeat Yourself •
Convention over Configuration • YAGNI - You ain't gonna need it
Source code Style • Two spaces, no tabs • Boolean
tests: don't use “and” and “or”, always use “&&” and “| |”
Go Easy on the Comments • If it's obvious –
don't explain it • Remove old commented code • “How to” comments
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
Parentheses (Optional)
Parentheses (Do & Don't)
Folding Up Lines
Folding Up Blocks
if vs unless
while vs until
Use Modifier Forms
each, NOT for
In the Wild
Use Symbols to Stand for Something
Composing Methods for Humans
Make the code a little more articulate
Readable Code
Readable code makes your classes easier to test
Git the diff says what you did; your commit message
should tell me why you did this
Summary Good code is like a good joke: It needs
no explanation
Credentials