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
The Role of Developer Relations in AI Product Success.
giftojabu1
0
120
OCI Vault 概要
oracle4engineer
PRO
0
9.7k
ハイパーパラメータチューニングって何をしているの
toridori_dev
0
140
OCI Network Firewall 概要
oracle4engineer
PRO
0
4.1k
Platform Engineering for Software Developers and Architects
syntasso
1
520
Terraform Stacks入門 #HashiTalks
msato
0
350
【Pycon mini 東海 2024】Google Colaboratoryで試すVLM
kazuhitotakahashi
2
500
障害対応指揮の意思決定と情報共有における価値観 / Waroom Meetup #2
arthur1
5
470
初心者向けAWS Securityの勉強会mini Security-JAWSを9ヶ月ぐらい実施してきての近況
cmusudakeisuke
0
120
TypeScript、上達の瞬間
sadnessojisan
46
13k
IBC 2024 動画技術関連レポート / IBC 2024 Report
cyberagentdevelopers
PRO
0
110
Application Development WG Intro at AppDeveloperCon
salaboy
0
190
Featured
See All Featured
Designing for Performance
lara
604
68k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
364
24k
Bash Introduction
62gerente
608
210k
The World Runs on Bad Software
bkeepers
PRO
65
11k
Why Our Code Smells
bkeepers
PRO
334
57k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
4
370
Raft: Consensus for Rubyists
vanstee
136
6.6k
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
356
29k
Agile that works and the tools we love
rasmusluckow
327
21k
GraphQLの誤解/rethinking-graphql
sonatard
67
10k
Fontdeck: Realign not Redesign
paulrobertlloyd
82
5.2k
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