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
Snowflake WEST ユーザー会第2回「ハンズオンセッション」
mabokaneko0802
0
340
チームビルディングを受けてみた
harukahosokawa
2
170
Invitation to Okinawa.rb in 2024
yasslab
PRO
1
840
JAWS-UG山梨第0回 AWSのユーザーコミュニティ支援
awsjcpm
0
160
バッドプラクティスから学ぶハワイアン航空で行く re:Invent
kentosuzuki
0
260
ラズパイカメラ向け ケーブル延長基板・ハウジングの開発
koheimasaki
PRO
1
280
How to get hundreds of organic backlinks through statistics link building
ronishehu
1
270
苦いビールを避ける冴えたやり方
watany
2
400
生成AIとミニ四駆で学ぶ! MATLAB/Simulink
covao
1
350
こんなにあるの? 最近のIPAトレンドを ざっくりまとめてみた
watany
3
940
GreenPAK 初心者向けハンズオン資料
aoisaya
2
430
AWSと学生支援 - Education-JAWS #0
awsjcpm
1
150
Featured
See All Featured
Building a Scalable Design System with Sketch
lauravandoore
462
33k
Automating Front-end Workflow
addyosmani
1370
200k
Raft: Consensus for Rubyists
vanstee
140
7k
We Have a Design System, Now What?
morganepeng
52
7.6k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
16k
What’s in a name? Adding method to the madness
productmarketing
PRO
22
3.5k
Optimizing for Happiness
mojombo
379
70k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
32
2.3k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
48
5.4k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
8
660
Large-scale JavaScript Application Architecture
addyosmani
512
110k
GitHub's CSS Performance
jonrohan
1031
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