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
Introduction to Ruby Programming Language
Search
Didik Wicaksono
August 26, 2017
Technology
2
200
Introduction to Ruby Programming Language
Created for For SARCCOM Indonesia meetup
Didik Wicaksono
August 26, 2017
Tweet
Share
More Decks by Didik Wicaksono
See All by Didik Wicaksono
CFP Advice for Global Diversity CFP Day 2019 Jakarta
did1k
0
57
Automate workflow with Ruby
did1k
0
88
Generating Multiple Dimension Icon Sprites for Retina Display
did1k
0
78
Cookpad Indonesia Technology Stack
did1k
1
280
Other Decks in Technology
See All in Technology
EventHub Startup CTO of the year 2024 ピッチ資料
eventhub
0
120
TypeScript、上達の瞬間
sadnessojisan
46
13k
100 名超が参加した日経グループ横断の競技型 AWS 学習イベント「Nikkei Group AWS GameDay」の紹介/mediajaws202411
nikkei_engineer_recruiting
1
170
第1回 国土交通省 データコンペ参加者向け勉強会③- Snowflake x estie編 -
estie
0
130
The Role of Developer Relations in AI Product Success.
giftojabu1
0
130
SREが投資するAIOps ~ペアーズにおけるLLM for Developerへの取り組み~
takumiogawa
1
340
Amazon CloudWatch Network Monitor のススメ
yuki_ink
1
210
SRE×AIOpsを始めよう!GuardDutyによるお手軽脅威検出
amixedcolor
0
130
安心してください、日本語使えますよ―Ubuntu日本語Remix提供休止に寄せて― 2024-11-17
nobutomurata
1
1k
RubyのWebアプリケーションを50倍速くする方法 / How to Make a Ruby Web Application 50 Times Faster
hogelog
3
940
BLADE: An Attempt to Automate Penetration Testing Using Autonomous AI Agents
bbrbbq
0
310
OCI Security サービス 概要
oracle4engineer
PRO
0
6.5k
Featured
See All Featured
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
27
840
Designing for humans not robots
tammielis
250
25k
StorybookのUI Testing Handbookを読んだ
zakiyama
27
5.3k
Documentation Writing (for coders)
carmenintech
65
4.4k
The Pragmatic Product Professional
lauravandoore
31
6.3k
Become a Pro
speakerdeck
PRO
25
5k
GitHub's CSS Performance
jonrohan
1030
460k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
26
1.4k
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
The Art of Programming - Codeland 2020
erikaheidi
52
13k
Adopting Sorbet at Scale
ufuk
73
9.1k
Gamification - CAS2011
davidbonilla
80
5k
Transcript
Ruby Programming Language
Didik Wicaksono CTO Cookpad Indonesia
Github: firewalker06 Twitter: did1k
I work in
Its where I learn to program with Ruby
The question is: Why Ruby?
Meet Matz
He invented Ruby in 1995
He designed Ruby to be human-oriented
Ruby syntax is designed to be elegant
print "elephant" if "elephant".include? "ant" "elephant"
print "elephant" if "elephant".include? "ant" You can speak this in
proper english: “Print an elephant if elephant include ant”
print "elephant" if "elephant".include? "ant" You can speak this in
proper english: “Print elephant if elephant include ant”
print "elephant" if "elephant".include? "ant" You can speak this in
proper english: “Print elephant if elephant include ant”
This sentence still doesn’t make any sense, but it is
readable You can speak this in proper english: “Print elephant if elephant include ant” print "elephant" if "elephant".include? "ant"
print "elephant" if "elephant".include? "ant" “if” can be used to
modify expression
print "elephant" if "elephant".include? "ant" “if” can be used to
modify expression Method name can have question mark
Writing Ruby code is easy because it can be written
in plain english
Programmer can express themselves into their code
movie.awesome? bedroom.with_twin_beds? recipe.cooked_under 10.minutes Programmer can express themselves into their
code
humans.obliterate!
humans.obliterate! unless humans.nice?
There are more than one way to do anything in
Ruby
false 2.negative? 2 < 0
"hello" puts "hello" $stdout.puts "hello" p "hello"
one = 1 two = 2 three = 3 one,
two, three = [1, 2, 3]
one = 1 two = 2 three = 3 one,
two, three = [1, 2, 3] one, two, three = 1, 2, 3 You don’t even need
[1, 2, 3, 4, 5].map { |element| element if element.even?
}.compact [2,4]
[1, 2, 3, 4, 5]. select { |element| element.even? }
[2,4]
[1, 2, 3, 4, 5].select(&:even?) [2,4]
Block arguments also makes Ruby popular
method do ... end method do |argument| ... end
%w(Google Yahoo MSN).map do |engine| "https://www.#{engine.downcase}.com" end ["https://www.google.com", "https://www.yahoo.com", "https://www.msn.com"]
Blocks allows us to attach closure to any method %w(Google
Yahoo MSN).map do |engine| "https://www.#{engine.downcase}.com" end this will be returned
Blocks allows us to attach closure to any method %w(Google
Yahoo MSN).map do |engine| "https://www.#{engine.downcase}.com" end this will be returned You don’t even need to write return
Almost forgot! %w(Google Yahoo MSN).map do |engine| "https://www.#{engine.downcase}.com" end Is
equal: ["Google", "Yahoo", "MSN"]
More Blocks
%w(jakarta bandung).map do |city| city.capitalize end
%w(jakarta bandung).map do |city| city.capitalize end ["Jakarta", "Bandung"]
%w(jakarta bandung).map(&:capitalize) ["Jakarta", "Bandung"]
[ ["jakarta", "province"], ["bandung", "city"] ].each do |name, type| puts
"#{name}_#{type}" end
"jakarta_province" "bandung_city" [ ["jakarta", "province"], ["bandung", "city"] ].each do |name,
type| puts "#{name}_#{type}" end
This kind of flexibility improves the joy of programming
You might notice that Ruby makes you write fewer codes
one = 1 two = 2 three = 3 one,
two, three = [1, 2, 3] one, two, three = 1, 2, 3 You don’t even need FLASHBACK!
[1, 2, 3, 4, 5].select(&:even?) [2,4] FLASHBACK!
Who doesn’t want to write less?
Have you tried programming with Ruby?
You might not noticed, but Mac users already have Ruby
(even though its outdated) Installation is pretty easy: https://www.ruby-lang.org/en/docum entation/installation/
It only takes 20 minutes to learn Ruby from this
page: https://www.ruby-lang.org/en/docu mentation/quickstart/
There is also tutorials in Bahasa Indonesia: https://www.idrails.com/
How about you try to learn together with fellow Rubyists?
Ruby community is known to be friendly (nice)
MINASWAN (Matz is nice and so we are nice) みなさん
(read: mina-san) translation: everyone (polite)
MINASWAN (Matz is nice and so we are nice) みなさん
(read: mina-san) translation: everyone (polite)
Friday Hug
None
None
In Indonesia, we are known as ID-Ruby We are active
on Slack and Telegram
In Indonesia, we are known as ID-Ruby We are active
on Slack and Telegram Feel free to join: http://ruby.id/slack and https://t.me/ruby_id
We held meetups regularly
We held meetups regularly
Ruby ecosystem is huge
More than 135,000 gems in rubygems.org
“Gems” are what we called as Ruby libraries
One of the most popular gem is Ruby on Rails
framework
It is said that Rails made Ruby gaining popularity in
2006
Its over 10 years, but Rails is still on demand!
https://infinum.co/the-capsized-eight/analyzing-rubygems-stats-v2016
Big companies that uses Ruby
• Github • Heroku • Airbnb • Shopify
How about in Indonesia?
• Bukalapak • Go-Jek • Midtrans • Vidio
Now you know!
List of Ruby companies in Indonesia can be seen in
ID-Ruby homepage!
None
Feel free to browse http://ruby.id !
How about?
Started using Rails on ver 1.2.3 with Ruby 1.8.7
Current Rails version is 5.1 with Ruby 2.4 Started using
Rails on ver 1.2.3 with Ruby 1.8.7 (2009!)
Previously we used ColdFusion
We have several large Rails applications running in Cookpad!
Our app servers run less than 100ms
If you are interested https://speakerdeck.com/mirakui/high-performance-rails-long-edition
If you are interested https://speakerdeck.com/a_matsuda/the-recip e-for-the-worlds-largest-rails-monolith
You can still be productive and run fast web application
with Ruby on Rails