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
120
Debugging and Profiling Rails App
dpaluy
3
210
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
Chaos V-Ray Render Pool (使い方)
renderpool
0
400
音に負けない!子どもが騒いでいる脇でも快適オンラインMTGの秘伝
kaitou
0
310
さらなるアウトプットに、Let's ライトニングトーク! ― LTのやり方
ma2shita
2
520
drumstick_jacket.pdf
lyh125
1
520
中指立てたか判定IoT #iotlt #p5js
n0bisuke2
0
230
PlatformIO IDE用M5Stack定型コード環境の紹介
3110
1
330
240420MapillaryMeetup2024Tokyo
tosseto
0
170
とある航空会社の飛行機の乗り方をお教えします。/20240913-lt
kwada
3
230
メイカーフェア東京、深セン、台北、サンフランシスコにみるFactory Automationみ/製造業み
takasumasakazu
0
1k
How to Hire a Driver for Long Distance Travel?
greaterservice
0
110
バタフライ効果/butterfly_effect
florets1
0
230
Terra Charge|EVコンセントご利用ガイドブック / Terra Charge EV Charger Guidebook
contents
0
1k
Featured
See All Featured
YesSQL, Process and Tooling at Scale
rocio
169
14k
Art, The Web, and Tiny UX
lynnandtonic
297
20k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
506
140k
Product Roadmaps are Hard
iamctodd
PRO
49
11k
Reflections from 52 weeks, 52 projects
jeffersonlam
346
20k
Why You Should Never Use an ORM
jnunemaker
PRO
54
9.1k
A Philosophy of Restraint
colly
203
16k
Building Flexible Design Systems
yeseniaperezcruz
327
38k
Faster Mobile Websites
deanohume
305
30k
The Straight Up "How To Draw Better" Workshop
denniskardys
232
140k
Fireside Chat
paigeccino
34
3k
GitHub's CSS Performance
jonrohan
1030
460k
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