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 best practices
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
100
Debugging and Profiling Rails App
dpaluy
3
200
Faster on Rails
dpaluy
2
190
How to Prepare 3 min Fundraising Presentation
dpaluy
0
960
Other Decks in How-to & DIY
See All in How-to & DIY
AI is Here, Are You Still Building PKM? ft. Ernest PKM 2023.25
dwchiang
0
7.5k
LT(Lightning Talk)のドキドキ感を共有しながら 応援してくれるBotを作ってみた!
scbc1167
0
150
【潔能講堂】 綠能科技動手做-磁生電燈 / 李薇平老師
learnenergy2
0
180
AWS User Community JAWS-UGとAWSグローバルコミュニティプログラム
awsjcpm
1
710
IoTカーテンオープナー
keicafeblack
0
110
How to Start RP2040
kata0510
0
1.1k
ついにiPaaSでobnizが動くかも?! #iotlt #pipedream #obniz
n0bisuke2
0
220
担当アイドルを応援する傘を作ろう! (として失敗した話)
subroh0508
0
340
Wear OSでwatch face作成~令和になってもCanvas芸?~
cibmc
1
590
やがてカンファレンス登壇者になる
yumechi
1
160
JAWS-UG勉強会オンライン配信事情
awsjcpm
1
120
Notionでの快適メモ術
ayumu11
0
490
Featured
See All Featured
The Cult of Friendly URLs
andyhume
72
5.6k
Designing for Performance
lara
601
67k
Agile that works and the tools we love
rasmusluckow
323
20k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
124
32k
Writing Fast Ruby
sferik
619
59k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
501
140k
Building a Modern Day E-commerce SEO Strategy
aleyda
15
6.3k
Code Reviewing Like a Champion
maltzj
512
39k
The Invisible Side of Design
smashingmag
293
49k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
24
2.2k
Producing Creativity
orderedlist
PRO
335
39k
Git: the NoSQL Database
bkeepers
PRO
421
63k
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