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
音に負けない!子どもが騒いでいる脇でも快適オンラインMTGの秘伝
kaitou
0
330
BVEと連動する誤自宅運転台のススメ!
usashirou
0
700
お家で育てる制御実験環境
zilmina
0
910
一番やさしいDJ入門 2024
stefafafan
6
1.9k
AWS Community Day 2024: Using AWS to build a launchable knowledge rocket 👉 Organize knowledge, accelerate learning and understand AI in the process
dwchiang
0
160
How to create better speaker proposals
logico_jp
2
590
miiboとamiibo繋げてみた。 #miibo #amiibo #iotlt
n0bisuke2
1
300
Terra Charge|普通充電器ご利用ガイドブック / Terra Charge Ordinary Charger Guidebook
contents
1
160
いぬぬウォッチャー - オレトク賞オンライン決勝 #ヒーローズリーグ
n0bisuke2
0
110
銀座線・半蔵門線から、ふりかえりカンファレンス2024現地会場への行き方
pokotyamu
0
250
スカウト返信率を倍にするためにやったこと / 2024-01-29
tamago3keran
2
990
未来大生の胃を支える函館グルメ
deflis
0
400
Featured
See All Featured
Building Your Own Lightsaber
phodgson
104
6.2k
The Power of CSS Pseudo Elements
geoffreycrofte
74
5.4k
Build your cross-platform service in a week with App Engine
jlugia
229
18k
A designer walks into a library…
pauljervisheath
205
24k
The World Runs on Bad Software
bkeepers
PRO
66
11k
Adopting Sorbet at Scale
ufuk
74
9.2k
jQuery: Nuts, Bolts and Bling
dougneiner
63
7.6k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
127
18k
Mobile First: as difficult as doing things right
swwweet
222
9k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
33
2k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
28
2.2k
Optimizing for Happiness
mojombo
376
70k
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