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
Weird Ruby (RubyDay 2024, Verona)
bbatsov
0
88
Sustainable OSS (Balkan Ruby 2024, Sofia)
bbatsov
0
100
Ruby's Creed (RubyDay 2023, Verona)
bbatsov
0
6
Victims of Complexity
bbatsov
0
290
Ruby 3.0 Redux (Spark Academy, Jan 2021)
bbatsov
1
240
Ruby 3.0 Redux (Pivorak 4.0)
bbatsov
0
420
The Elements of Programming Style (HackConf 2019)
bbatsov
0
160
The Groundhog Day Development Method (HackConf 2019)
bbatsov
0
250
CIDER Distilled: A Common Foundation for Clojure Tooling
bbatsov
0
230
Other Decks in Programming
See All in Programming
WEBエンジニア向けAI活用入門
sutetotanuki
0
270
Honoの来た道とこれから
yusukebe
18
2.9k
CSC509 Lecture 07
javiergs
PRO
0
140
#pixiv小説画像メーカー はこうしてできた / The Making of the pixiv Novel Image Maker
roiban
0
170
Java ジェネリクス入門 2024
nagise
0
480
破壊せよ!データ破壊駆動で考えるドメインモデリング / data-destroy-driven
minodriven
13
3.6k
レイトレ合宿10 レンダラー紹介 / Renderer Introduction, Ray Tracing Camp 10
shocker_0x15
0
670
CPython 인터프리터 구조 파헤치기 - PyCon Korea 24
kennethanceyer
0
200
Why Spring Matters to Jakarta EE - and Vice Versa
ivargrimstad
0
520
Folding Cheat Sheet #8
philipschwarz
PRO
0
160
Identifying User Idenity
moro
4
5.1k
Vertical Architectures for Scalable Angular Applications
manfredsteyer
PRO
0
270
Featured
See All Featured
Writing Fast Ruby
sferik
626
60k
GraphQLとの向き合い方2022年版
quramy
43
13k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
280
13k
Side Projects
sachag
452
42k
GitHub's CSS Performance
jonrohan
1030
460k
Thoughts on Productivity
jonyablonski
67
4.3k
VelocityConf: Rendering Performance Case Studies
addyosmani
325
24k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
167
49k
Testing 201, or: Great Expectations
jmmastey
38
7k
Art, The Web, and Tiny UX
lynnandtonic
296
20k
Code Review Best Practice
trishagee
64
17k
Designing Experiences People Love
moore
138
23k
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