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
440
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
100
Sustainable OSS (Balkan Ruby 2024, Sofia)
bbatsov
0
110
Ruby's Creed (RubyDay 2023, Verona)
bbatsov
0
8
Victims of Complexity
bbatsov
0
300
Ruby 3.0 Redux (Spark Academy, Jan 2021)
bbatsov
1
240
Ruby 3.0 Redux (Pivorak 4.0)
bbatsov
0
430
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
250
Other Decks in Programming
See All in Programming
As an Engineers, let's build the CRM system via LINE Official Account 2.0
clonn
1
670
Criando Commits Incríveis no Git
marcelgsantos
2
170
なまけものオバケたち -PHP 8.4 に入った新機能の紹介-
tanakahisateru
1
120
複雑な仕様に立ち向かうアーキテクチャ
myohei
0
170
KubeCon + CloudNativeCon NA 2024 Overviewat Kubernetes Meetup Tokyo #68 / amsy810_k8sjp68
masayaaoyama
0
250
CSC305 Lecture 26
javiergs
PRO
0
140
モバイルアプリにおける自動テストの導入戦略
ostk0069
0
110
見えないメモリを観測する: PHP 8.4 `pg_result_memory_size()` とSQL結果のメモリ管理
kentaroutakeda
0
130
Scalaから始めるOpenFeature入門 / Scalaわいわい勉強会 #4
arthur1
1
300
20年もののレガシープロダクトに 0からPHPStanを入れるまで / phpcon2024
hirobe1999
0
110
Effective Signals in Angular 19+: Rules and Helpers @ngbe2024
manfredsteyer
PRO
0
130
これが俺の”自分戦略” プロセスを楽しんでいこう! - Developers CAREER Boost 2024
niftycorp
PRO
0
190
Featured
See All Featured
Code Reviewing Like a Champion
maltzj
520
39k
How GitHub (no longer) Works
holman
311
140k
A Philosophy of Restraint
colly
203
16k
GitHub's CSS Performance
jonrohan
1030
460k
StorybookのUI Testing Handbookを読んだ
zakiyama
27
5.3k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
226
22k
Unsuck your backbone
ammeep
669
57k
The Power of CSS Pseudo Elements
geoffreycrofte
73
5.4k
Fantastic passwords and where to find them - at NoRuKo
philnash
50
2.9k
GraphQLとの向き合い方2022年版
quramy
44
13k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
29
2.3k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
95
17k
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