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
The Master Rubyist
Search
Bozhidar Batsov
June 07, 2016
Programming
1
430
The Master Rubyist
Slide deck from my RubyC 2016 presentation.
Bozhidar Batsov
June 07, 2016
Tweet
Share
More Decks by Bozhidar Batsov
See All by Bozhidar Batsov
Victims of Complexity
bbatsov
0
270
Ruby 3.0 Redux (Spark Academy, Jan 2021)
bbatsov
1
230
Ruby 3.0 Redux (Pivorak 4.0)
bbatsov
0
410
The Elements of Programming Style (HackConf 2019)
bbatsov
0
160
The Groundhog Day Development Method (HackConf 2019)
bbatsov
0
240
CIDER Distilled: A Common Foundation for Clojure Tooling
bbatsov
0
190
Ruby 3.0: Redux (Saint P RubyConf 2019)
bbatsov
0
220
Ruby 3 Redux
bbatsov
0
330
nREPL Redux (DCD 2019)
bbatsov
1
480
Other Decks in Programming
See All in Programming
Ruby GitHub Packages
bkuhlmann
0
620
DMMプラットフォームがTiDB Cloudを採用した背景
pospome
8
3.7k
スクラムガイドのスプリントレトロスペクティブを改めて読みかえしてみた / Re-reading the Sprint Retrospective Section in the Scrum Guide
mackey0225
3
350
try! Swift Tokyo 2024 参加報告 / try! Swift Tokyo 2024 Report
hironytic
0
180
Ruby Pattern Matching
bkuhlmann
0
920
Code Reviews
bkuhlmann
4
880
Elm 0.19.0 Changes
bkuhlmann
0
490
チーム力を高めるスクラム実践法:カンバン公開と課題攻略について - ニフティのスクラムトーク Vol. 2 - NIFTY Tech Talk #18
niftycorp
PRO
1
110
Git Rebase
bkuhlmann
11
1.6k
はてなにおける CSS Modules、及び CSS Modules に足りないもの / CSS Modules in Hatena, and CSS Modules missing parts
mizdra
5
680
Site Reliability Engineering for GMO
pyama86
6
980
今の SmartHR にエンジニアで入社するとどうなるの?
daisukeshinoku
5
4.6k
Featured
See All Featured
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
19
1.9k
A Modern Web Designer's Workflow
chriscoyier
688
190k
Faster Mobile Websites
deanohume
297
30k
Put a Button on it: Removing Barriers to Going Fast.
kastner
58
3k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
352
28k
StorybookのUI Testing Handbookを読んだ
zakiyama
11
4.6k
VelocityConf: Rendering Performance Case Studies
addyosmani
320
23k
Keith and Marios Guide to Fast Websites
keithpitt
408
22k
Scaling GitHub
holman
457
140k
Code Review Best Practice
trishagee
54
15k
5 minutes of I Can Smell Your CMS
philhawksworth
199
19k
Documentation Writing (for coders)
carmenintech
59
3.9k
Transcript
None
Божидар
@bbatsov
I’m back
epic fail
None
Hakuna Matata, what a wonderful phrase Hakuna Matata, ain't no
passing craze It means no worries for the rest of your days It's our problem free philosophy, Hakuna Matata
They call me Master…
… and I’m a Rubyist
I must be The Master Rubyist!
None
Sofia, Bulgaria
Sofia, Bulgaria
None
Tarnovo, Bulgaria
None
None
None
Dashingly handsome
Sings like an angel
Loves karaoke
Is very responsible
Was very responsible last night
Loves beer
Loves scotch
Loves vodka
Terrified by gorilka
Loves Ruby
Loves Ruby
Loves Ruby
Loves Ruby
Uses tabs instead of spaces
Uses vim
None
Emacs fanatic
Star Wars fanatic
Batman
None
Loves OSS
Does some OSS development
None
On the core team of some projects
Works for a famous company
None
Loved by his team
None
Loved by his team
The Master Rubyist D[$Q\JKFCT$CVUQX
Master
having or showing very great skill or proficiency
None
Novice
a person new to and inexperienced in a job or
situation
None
Journeyman
a worker, performer, or athlete who is experienced and good
but not excellent
None
The Road to Mastery
None
not really
try 10 years
http://norvig.com/21- days.html Teach Yourself Programming in Ten Years Peter Norvig
Apprenticeship
Novice Journeyman Master Apprenticeship Apprenticeship
Object-oriented programming
None
Ruby is a purely object- oriented language
None
None
Know Thy Language!
Crazy People
None
Ruby is a VERY COMPLEX language!
class instance variable
protected
module_function vs extend self
refinements
super vs super()
== === equal? eql?
None
None
Grokking the language
Understanding and appreciating its philosophy
Coming to grips with reality
(no language is perfect)
(not even Clojure)
(some languages really suck)
Master the idioms
for i in 1..3 puts "Hello, Kiev!" end
3.times do puts "Hello, Kiev!" end
if some_condition then # body omitted end
def some_method # ... return result end
None
None
None
Read some (good) code
some == A LOT
None
Obtain a notion of style
A style guide • a curated set of (supposedly) good
practices • spares you the process of making trivial decisions • allows you to focus on the actual problems • simple and concise
None
Use the active voice.
My first visit to Kiev will always be remembered by
me. lame
I shall always remember my first visit to Kiev. legit
The word personally is often unnecessary.
Personally, I love RubyC.
Style guides aren’t a replacement for thinking
None
Write clearly -- don't be too clever.
def user_signed_in? !!@current_user end def user_signed_in? !@current_user.nil? end
Don't sacrifice clarity for small gains in efficiency.
i = 1 res = 0 while i <= 10
res += i i += 1 end
(1..10).reduce(:+)
(N * (N + 1)) / 2
(10 * (10 + 1)) / 2
Ruby Style Guide https://github.com/bbatsov/ruby-style-guide
None
Tackle problems with style
None
puts debugging sucks
bla bla bla puts ‘********’ puts x puts ‘********’
None
pro “puts” debugging techniques
object = Object.new puts object.method(:blank?).source_location # => ["/gems/ activesupport-5.0.0.beta1/lib/ active_support/core_ext/object/
blank.rb", 14]
class Bar def foo puts "=====================" puts caller end end
def foo puts method(:foo).super_method.source_location super end
def parse(input, skip_code_comments: false, ignore_whitespace: true) # do stuff end
method(:parse).parameters #=> [[:req, :input], [:key, :skip_code_comments], [:key, :ignore_whitespace]]
config.thing = { "foo" => "bar" } config.thing.freeze = {
"foo" => "bar" } config.thing.delete("foo") # active_support/concurrency/share_lock.rb:151:in `delete': can't modify frozen Hash (RuntimeError) # from active_support/concurrency/share_lock.rb:151:in `yield_shares' # from active_support/concurrency/share_lock.rb:79:in `block in stop_exclusive'
Ruby Debugging Magic Cheat Sheet http://www.schneems.com/2016/01/25/ruby-debugging- magic-cheat-sheet.html
I am a puts debugger https://tenderlovemaking.com/2016/02/05/i-am-a-puts- debuggerer.html
I am not a puts debugger!
byebug https://github.com/deivid-rodriguez/byebug
pry-byebug https://github.com/deivid-rodriguez/pry-byebug
Profiling stuff
ruby-prof https://github.com/ruby-prof/ruby-prof
memory_profiler https://github.com/SamSaffron/memory_profiler
The Editors
Emacs
vim
Spacemacs
What about the rest?
None
Emacs & vim are forever!
None
None
Interactive programming
The REPL is king!
pry > irb
Rails
None
Beyond Rails
Opal
RubyMotion
System administration
JRuby
Alternative web frameworks
Volt
Hanami
Padrino
Sinatra
Roda
Keep in sync
RubyWeekly
Ruby5
RubyRogues
RubyTapas
GoRails
RubyConf
RailsConf
Always be exploring!
Clojure
Haskell
Elm
Erlang/Elixir
Racket
Ideas from other programming languages make us better programmers
One more thing…
Ruby is simply not a good fit for every possible
problem
None
None
Felina