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
210
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
62
Automate workflow with Ruby
did1k
0
88
Generating Multiple Dimension Icon Sprites for Retina Display
did1k
0
78
Cookpad Indonesia Technology Stack
did1k
1
290
Other Decks in Technology
See All in Technology
組織に自動テストを書く文化を根付かせる戦略(2024冬版) / Building Automated Test Culture 2024 Winter Edition
twada
PRO
16
4.3k
サーバレスアプリ開発者向けアップデートをキャッチアップしてきた #AWSreInvent #regrowth_fuk
drumnistnakano
0
200
PHP ユーザのための OpenTelemetry 入門 / phpcon2024-opentelemetry
shin1x1
1
230
GitHub Copilot のテクニック集/GitHub Copilot Techniques
rayuron
36
14k
Microsoft Azure全冠になってみた ~アレを使い倒した者が試験を制す!?~/Obtained all Microsoft Azure certifications Those who use "that" to the full will win the exam! ?
yuj1osm
2
110
How to be an AWS Community Builder | 君もAWS Community Builderになろう!〜2024 冬 CB募集直前対策編?!〜
coosuke
PRO
2
2.8k
OpenAIの蒸留機能(Model Distillation)を使用して運用中のLLMのコストを削減する取り組み
pharma_x_tech
4
560
re:Invent をおうちで楽しんでみた ~CloudWatch のオブザーバビリティ機能がスゴい!/ Enjoyed AWS re:Invent from Home and CloudWatch Observability Feature is Amazing!
yuj1osm
0
120
フロントエンド設計にモブ設計を導入してみた / 20241212_cloudsign_TechFrontMeetup
bengo4com
0
1.9k
あの日俺達が夢見たサーバレスアーキテクチャ/the-serverless-architecture-we-dreamed-of
tomoki10
0
460
.NET 9 のパフォーマンス改善
nenonaninu
0
970
alecthomas/kong はいいぞ / kamakura.go#7
fujiwara3
1
300
Featured
See All Featured
Agile that works and the tools we love
rasmusluckow
328
21k
Learning to Love Humans: Emotional Interface Design
aarron
273
40k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
507
140k
How To Stay Up To Date on Web Technology
chriscoyier
789
250k
What's in a price? How to price your products and services
michaelherold
243
12k
VelocityConf: Rendering Performance Case Studies
addyosmani
326
24k
The Illustrated Children's Guide to Kubernetes
chrisshort
48
48k
Adopting Sorbet at Scale
ufuk
73
9.1k
Writing Fast Ruby
sferik
628
61k
Keith and Marios Guide to Fast Websites
keithpitt
410
22k
The MySQL Ecosystem @ GitHub 2015
samlambert
250
12k
Being A Developer After 40
akosma
87
590k
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