Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
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
220
Faster on Rails
dpaluy
2
200
How to Prepare 3 min Fundraising Presentation
dpaluy
0
980
Other Decks in How-to & DIY
See All in How-to & DIY
JAWS-UG/AWSコミュニティ JAWS-UG おおいた
awsjcpm
2
2.8k
ミニ四駆ベースのAIカー TatamiRacerの製作
covao
1
210
DroidKaigi 2024 - 海外就職というキャリアの選択肢
iyotetsuya
1
960
すぐできる! 運送業でやってみた業務効率化3選
dochin2635
0
110
AWS Community Day 2024: Using AWS to build a launchable knowledge rocket 👉 Organize knowledge, accelerate learning and understand AI in the process
dwchiang
0
210
バーチャルバナナとリアルバナナ #iotlt #TouchDesigner
n0bisuke2
0
160
JAWS-UGとAWS - JAWS-UG彩の国埼玉設立のお祝い
awsjcpm
2
500
「無理」を「コントロール」するスキル / Skills to Control "Muri"
hageyahhoo
6
2.3k
グローバルAWSユーザー コミュニティとJAWS-UG - JAWS FESTA 2024 in Hiroshima
awsjcpm
0
4.8k
3ヶ月でできる! 探査機自作ゼミ教材自作入門
sksat
6
2.7k
静岡県のお相撲さん20240509/sumo_wrestler_from_shizuoka_prefecture_20240509
nicepapa_hirano
0
280
2025年03月02日 メイカーズながおかまつり での講演 「コミュニティベースでの製品開発ものづくりフェアの役割」
takasumasakazu
0
240
Featured
See All Featured
Optimizing for Happiness
mojombo
379
70k
Java REST API Framework Comparison - PWX 2021
mraible
31
8.7k
A Tale of Four Properties
chriscoyier
160
23k
Making Projects Easy
brettharned
116
6.3k
Mobile First: as difficult as doing things right
swwweet
223
9.7k
Thoughts on Productivity
jonyablonski
69
4.7k
Building an army of robots
kneath
306
45k
Six Lessons from altMBA
skipperchong
28
3.9k
How to train your dragon (web standard)
notwaldorf
96
6.1k
How GitHub (no longer) Works
holman
314
140k
Scaling GitHub
holman
461
140k
A Modern Web Designer's Workflow
chriscoyier
695
190k
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