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
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
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
36
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
Apple Intelligence を用いた個人情報誤送信防止、及びユーザーリクエスト体験の改善について
yukiny
0
350
AIに “答え“を書かせるのを やめてみた
___akari11
0
120
Domain-Driven Transformation
hschwentner
2
2.3k
半永久的に提供し続けられるプライベートクラウドを目指して ― 利用者の認知負荷を抑えるAPI抽象化とハードウェア世代交代の基盤設計
tomokon
0
500
AIで開発が速くなった先で、開発チームは何を目指すか
shihochan
0
880
Atomic Design, Enforced: Scaling Mobile Design Systems (next.app devCon / droidCon Berlin 2026)
steliosf
PRO
0
170
Railsバージョンを4倍にした話
optim
0
350
Long Living Tokens, Die, Die, Die! (or: The One Ring is Banned in Modern)
sylph01
0
300
AI主導のプログラミング学習アプリを作ってみた
econanringo
0
180
ActionController meets Protocol Buffers
sorah
0
520
[Dev Group Paris Octobre 26] Agentforce, SIforce, Claudeforce, Slackbot… on s'y retrouve ?
nabondance
0
110
JIS keyboard support in Omarchy
lef237
0
110
Featured
See All Featured
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
16
2.2k
The AI Revolution Will Not Be Monopolized: How open-source beats economies of scale, even for LLMs
inesmontani
PRO
3
3.8k
Design in an AI World
tapps
1
350
Building a Modern Day E-commerce SEO Strategy
aleyda
45
9.3k
Practical Orchestrator
shlominoach
192
12k
Avoiding the “Bad Training, Faster” Trap in the Age of AI
tmiket
0
270
The Art of Programming - Codeland 2020
erikaheidi
57
14k
Automating Front-end Workflow
addyosmani
1369
210k
Context Engineering - Making Every Token Count
addyosmani
9
1.2k
The browser strikes back
jonoalderson
0
1.8k
SEOcharity - Dark patterns in SEO and UX: How to avoid them and build a more ethical web
sarafernandez
0
300
HDC tutorial
michielstock
2
960
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