Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Ten Commandments of the Ruby Programmer
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Emilio Gutter
October 09, 2014
Programming
120
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Ten Commandments of the Ruby Programmer
Emilio Gutter
October 09, 2014
More Decks by Emilio Gutter
See All by Emilio Gutter
¿No más secretos?
egutter
0
35
Collaborative entrepreneurship case study
egutter
0
41
Self-Organizing the organization
egutter
1
190
Los diez mandamientos del programador ágil
egutter
0
690
Growing apprentices
egutter
0
35
Other Decks in Programming
See All in Programming
デプロイ直後のレイテンシスパイクを調べたら、 Railsの仕様にたどり着いた
nhsykym
0
110
Family mrubyの進捗
kishima
1
110
新卒PdEのリアル
ryu1013
1
480
コンパウンドプロダクト開発のためのローカルプロセスマネージャー再発明 #layerxgo
izumin5210
0
660
GraphRAGのKnowledge Graphを 直接!見る/View-GraphRAG's-KnowledgeGraph-directly!
tyumugi1113
1
280
不幸な GC
chencmd
0
900
thread_parallel_with_free-threaded_Python_and_NumPy.pdf
riku_sakamoto
0
270
Go × SIMDで高速化するベクトル検索 ~ルーフラインモデルでSIMDが効く境界を探れ! ~
po3rin
1
210
モバイル交通系ICへのチャージ実例から考える、クロスプラットフォーム開発におけるiOS実機テスト設計とCI運用
yusuga
1
290
Intent as Code
shoppingjaws
6
770
Press start. Python's next generation.
willingc
PRO
3
340
go-spidermonkeyでAIエージェントのCode Modeを実装する
syumai
3
1.5k
Featured
See All Featured
Visual Storytelling: How to be a Superhuman Communicator
reverentgeek
2
660
Building Better People: How to give real-time feedback that sticks.
wjessup
370
20k
The Spectacular Lies of Maps
axbom
PRO
1
990
Effective software design: The role of men in debugging patriarchy in IT @ Voxxed Days AMS
baasie
0
510
Practical Orchestrator
shlominoach
191
12k
DevOps and Value Stream Thinking: Enabling flow, efficiency and business value
helenjbeal
1
380
Rails Girls Zürich Keynote
gr2m
96
14k
WENDY [Excerpt]
tessaabrams
13
39k
The AI Revolution Will Not Be Monopolized: How open-source beats economies of scale, even for LLMs
inesmontani
PRO
3
3.7k
Redefining SEO in the New Era of Traffic Generation
szymonslowik
1
410
The Curious Case for Waylosing
cassininazir
1
500
brightonSEO & MeasureFest 2025 - Christian Goodrich - Winning strategies for Black Friday CRO & PPC
cargoodrich
3
830
Transcript
THE TEN COMMANDMENTS of the ruby programmer
I AM EMILIO A RUBY PROGRAMMER Software developer +15 yrs
10Pines founder Agiles community founding member agiles 2012 conference co-chair husband, father and homeBrewer
I. Thou shalt have no domain objects coupled with thy
frameworks
class Speaker < ActiveRecord::Base ! devise :omniauthable, :omniauth_providers => [:facebook]
! def approve_session(session) # do something SessionMailer.approve(speaker: self, session: session).deliver end ! end
II. THOU SHALT NOT STEAL & PASTE CODE
public List selectPending(List registrations) { ! List pending = new
ArrayList(); for (Registration registration: registrations) { if (!registration.isPaid()) { pending.add(registration); } } return pending; }
! def select_pending(registrations) registrations.reject(&:paid?) end ! !
class SessionsController < ApplicationController ! def create ! @session =
Session.new(session_params) ! if @session.save redirect_to my_sessions_path, notice: 'Session created successfully' else render :new end ! end end
class Program ! def find_by_author(author) ! sessions = Session.where(author: author,
approved: true) ! if sessions.empty? # do something else # do something end end ! end
III. THOU SHALT NOT USE NIL
class AttendeePresenter ! def phone_number ! unless self.address.nil? unless self.address.phone_number.nil?
self.address.phone_number else 'Phone number not present' end else 'Address not present' end end ! end
class Attendee def initialize(address) if address.nil? raise ArgumentError, 'Address is
required' end @address = address end ! def address @address || UnknownAddress.new end ! def phone_number Optional.new(@address). within {|address| address.phone_number} end end
IV. THOU SHALT NOT USE IF
class BankAccount ! def process a_transaction ! if a_transaction.type ==
:purchase # charge transaction fee else # assume refund end end ! end
class BankAccount ! def process a_transaction a_transaction.process self end !
def process_purchase a_transaction # charge transaction fee end ! def process_refund a_transaction # refund transaction fee end ! end
class Purchase < Transaction ! def process a_payment_method a_payment_method.process_purchase self
end end ! class Refund < Transaction ! def process a_payment_method a_payment_method.process_refund self end end
V. THOU SHALT NOT MOCK
require 'spec_helper' ! describe Registration do ! it 'pays a
registration' do ! attendee_id = 1 a_registration = double("Registration") an_attendee = double("Attendee", registration: a_registration) ! allow(Attendee).to receive(:find) { an_attendee } ! expect(a_registration).to receive(:paid=).with(true) expect(a_registration).to receive(:save).and_return(true) ! expect_any_instance_of(PaypalAccount).to receive(:process) ! Registration.pay(attendee_id) ! end end
VI. THOU SHALT NOT TAKE THY TESTS IN VAIN
VI. THOU SHALT NOT TAKE THY IN VAIN VII. REMEMBER
TO REFACTOR EVERY DAY
VI. THOU SHALT NOT TAKE THY IN VAIN VII. REMEMBER
TO REFACTOR VII. THOU SHALT BEAR YOUR FELLOW PROGRAMMERS AND PAIR WITH THEM
IX. CHALLENGE HONOUR /[RUBY|RAILS|.*]/ FATHER AND MOTHER
X. NO GRAVEN PRACTICES
QUESTIONS? comments, critics, compliments
THANKS!!! email:
[email protected]
twitter: @10pines site: dev.10pines.com blog: blog.10pines.com