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
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
AI に Inclusive UI を書かせよう — Design Rules Skill で Compose UI を作り直す
theoriatec2024
1
500
Augmenting AI with the Power of Jakarta EE
ivargrimstad
0
210
一人だけ、Kiroが静止する日
hideg
0
120
モバイル交通系ICへのチャージ実例から考える、クロスプラットフォーム開発におけるiOS実機テスト設計とCI運用
yusuga
1
520
FreeBSDでZabbixを動かす
kenkino
0
310
Building an Out-of-Order CPU
latte72
1
790
海上で動くGoサーバー: goroutineとchannelでさばく航行データストリーム
atsuki_seo
0
740
AI が書く Go コードの品質を劇的に向上させる Linter: “declscope”
mpyw
0
380
SREの越境 / SRE Collaboration
y0hgi
2
260
Go × SIMDで高速化するベクトル検索 ~ルーフラインモデルでSIMDが効く境界を探れ! ~
po3rin
1
2.2k
AGENTS.md Is Not Enough:Build Skills, Don't Download Them
lx_t
0
120
技術的負債を組織課題として解く-増えすぎたマイクロサービスとの戦い-
reimaru
1
2k
Featured
See All Featured
DBのスキルで生き残る技術 - AI時代におけるテーブル設計の勘所
soudai
PRO
68
57k
A designer walks into a library…
pauljervisheath
211
25k
Believing is Seeing
oripsolob
1
220
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
17k
AI Search: Where Are We & What Can We Do About It?
aleyda
0
8k
Effective software design: The role of men in debugging patriarchy in IT @ Voxxed Days AMS
baasie
1
530
New Earth Scene 8
popppiees
4
2.6k
SEO Brein meetup: CTRL+C is not how to scale international SEO
lindahogenes
2
2.9k
Dominate Local Search Results - an insider guide to GBP, reviews, and Local SEO
greggifford
PRO
0
330
How Fast Is Fast Enough? [PerfNow 2025]
tammyeverts
3
900
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.8k
Keith and Marios Guide to Fast Websites
keithpitt
413
23k
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