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
A Hands-On Introduction to Ruby
Search
Zach Latta
July 27, 2013
Programming
1
940
A Hands-On Introduction to Ruby
A brief introduction to the wonderful world of Ruby.
Zach Latta
July 27, 2013
Tweet
Share
More Decks by Zach Latta
See All by Zach Latta
The Art of Code
zach
0
160
Start a Hack Club
zach
0
150
Curiosity, Education, And What We Can Do Better
zach
1
620
Introduction to the Command-Line
zach
0
130
Other Decks in Programming
See All in Programming
技術的負債で信頼性が限界だったWordPress運用をShifterで完全復活させた話
rvirus0817
1
1.4k
中級グラフィックス入門~効率的なメッシュレット描画~
projectasura
4
2.6k
No Install CMS戦略 〜 5年先を見据えたフロントエンド開発を考える / no_install_cms
rdlabo
0
480
あのころの iPod を どうにか再生させたい
orumin
2
2.4k
『リコリス・リコイル』に学ぶ!! 〜キャリア戦略における計画的偶発性理論と変わる勇気の重要性〜
wanko_it
1
450
DynamoDBは怖くない!〜テーブル設計の勘所とテスト戦略〜
hyamazaki
0
200
AIのメモリー
watany
13
1.4k
Go製CLIツールをnpmで配布するには
syumai
2
1.2k
AIに安心して任せるためにTypeScriptで一意な型を作ろう
arfes0e2b3c
0
340
あなたとJIT, 今すぐアセンブ ル
sisshiki1969
1
590
Constant integer division faster than compiler-generated code
herumi
2
580
JetBrainsのAI機能の紹介 #jjug
yusuke
0
200
Featured
See All Featured
Why Our Code Smells
bkeepers
PRO
337
57k
StorybookのUI Testing Handbookを読んだ
zakiyama
30
6k
Testing 201, or: Great Expectations
jmmastey
45
7.6k
Typedesign – Prime Four
hannesfritz
42
2.7k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
34
6k
Rebuilding a faster, lazier Slack
samanthasiow
83
9.1k
Scaling GitHub
holman
461
140k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
131
19k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
8
760
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
47
9.6k
For a Future-Friendly Web
brad_frost
179
9.9k
Java REST API Framework Comparison - PWX 2021
mraible
33
8.8k
Transcript
RUBY zach latta a hands-on introduction to
ruby is a high productivity scripting language
Japan made in designed by matsumoto yukihiro
matz
None
None
None
None
...and many more
it’s fun idiomatic poignant not java
objects. objects everywhere.
1 "DO NOT USE ALL CAPS".downcase => "do not use
all caps" valid ruby 2 5.rationalize => (5/1)
i can’t believe it’s not english!
1 5.times { print "hi" } => "hihihihihi" print “hi”
five times 2 print "hi" * 5 => "hihihihihi"
1 import java.io.* 2 3 public class Hi 4 {
5 public static void main(String[] args) 6 { 7 for (int i = 0; i < 5; i++) 8 { 9 System.out.print("hi"); 10 } 11 } 12 } …and in java
quickly and easily understand other ruby
1 print 'This is not a '\ 'palindrome'.reverse => "emordnilap
a ton si sihT"
“code so beautiful that tears are shed” - why’s poignant
guide to ruby
1 puts "What is your name?" 2 name = gets.strip!
3 4 puts "Hello #{ name }. How are you?" greetings
! 1 import java.util.Scanner; 2 3 public class ALessNiceGreeting 4
{ 5 public static void main(String[] args) 6 { 7 Scanner scanner = new Scanner(System.in); 8 9 System.out.println("What is your name?"); 10 String name = scanner.nextLine().trim(); 11 12 System.out.println("Hi " + name + ". How are you?"); 13 14 scanner.close(); 15 } 16 } greetings (cont.)
1 contents = File.read('file.txt') 2 puts contents file io
1 import java.io.BufferedReader; 2 import java.io.FileReader; 3 import java.io.IOException; 4
5 public class BufferedReaderExample 6 { 7 public static void main(String[] args) 8 { 9 BufferedReader br = null; 10 11 try 12 { 13 14 String sCurrentLine; 15 16 br = new BufferedReader(new FileReader("file.txt")); 17 18 while ((sCurrentLine = br.readLine()) != null) 19 { 20 System.out.println(sCurrentLine); 21 } 22 23 } 24 catch (IOException e) 25 { 26 e.printStackTrace(); 27 } 28 finally 29 { 30 try 31 { 32 if (br != null)br.close(); 33 } 34 catch (IOException ex) 35 { 36 ex.printStackTrace(); 37 } 38 } 39 40 } 41 } file io (cont.)
power simplicity vs.
1 def a_method 2 puts "Hello world!" 3 end methods
1 get ‘/‘ do 2 'Hello world!' 3 end dsl
gems
bogosort while !sorted(deck) { shuffle(deck) }
bogosort best case: ΩΩ(n) worst case: Unbounded average case: O(n
× n!)
• http://mislav.uniqpath.com/ poignant-guide/ • http://tryruby.org • make something!
github.com/zachlatta/baas speakerdeck.com/zach/a- hands-on-introduction-to-ruby
[email protected]
e: w: zachlatta.com g: github.com/zachlatta