Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Speaker Deck
PRO
Sign in
Sign up for free
Code Reading
高見龍
May 31, 2013
Programming
6
1.1k
Code Reading
Learning More about Ruby by Reading Ruby Source Code'
高見龍
May 31, 2013
Tweet
Share
More Decks by 高見龍
See All by 高見龍
Learn JavaScript Well
eddie
1
1.1k
How to Learn Web Framework Correctly
eddie
4
1.8k
about-5xruby
eddie
0
76
Ruby on Rails 2018 年進化論
eddie
0
110
10 years in learning Ruby
eddie
5
1.3k
傳說中可以治百病的區塊鏈是怎麼一回事?
eddie
0
1.7k
Git Branch
eddie
0
310
Refactoring (Ruby edition)
eddie
0
200
非科班阿宅之 自我技術精進之道
eddie
0
270
Other Decks in Programming
See All in Programming
マルチプロダクト×非構造化データ×機械学習を支えるデータ信頼性
akino
0
160
パターンマッチングを学んで新しいJavaの世界へ!Java 18までの目玉機能をおさらいしよう / Java 18 pattern matching
ihcomega56
3
420
Jetpack Compose, 어디까지 알고 있을까?
jisungbin
0
120
Jetpack Composeでの画面遷移
iwata_n
0
190
社用PCのdotfiles管理 / dotfiles-in-company
yammerjp
0
140
GoogleI/O2022 LT報告会資料
shinsukefujita1126
0
400
VisualProgramming_GoogleHome_LINE
nearmugi
1
230
Cybozu GoogleI/O 2022 LT会 - Input for all screens
jaewgwon
0
380
こそこそアジャイル導入しようぜ!
ichimichi
0
1.3k
設計の学び方:自分流のススメ
masuda220
PRO
10
7.4k
競プロのすすめ
uya116
0
680
iOS 16からのロック画面Widget争奪戦に備える
tsuzuki817
0
260
Featured
See All Featured
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
151
13k
The Web Native Designer (August 2011)
paulrobertlloyd
74
1.9k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
105
16k
Code Review Best Practice
trishagee
43
9.3k
Fontdeck: Realign not Redesign
paulrobertlloyd
73
4.1k
5 minutes of I Can Smell Your CMS
philhawksworth
196
18k
Six Lessons from altMBA
skipperchong
14
1.4k
Docker and Python
trallard
27
1.6k
Teambox: Starting and Learning
jrom
123
7.7k
Fireside Chat
paigeccino
12
1.3k
Designing on Purpose - Digital PM Summit 2013
jponch
106
5.6k
Testing 201, or: Great Expectations
jmmastey
21
5.4k
Transcript
None
高見 龍 です
高 見龍 です @eddiekao
Code Reading Chimpr Learning more about Ruby by Reading Ruby
Source Code
I come from Taiwan photo by Fishtail@Taipei
photo by J o n a G r a p
h Y
photo by HeyNix
photo by randomwire
None
None
I’m a Python guy (≈ 2 years) I’m a iOS
app guy (≈ 2 years) I’m a Flash guy (≈ 8 years) I’m a Ruby guy (≈ 4 years)
But not a C guy, yet!
Ruby > Rails
“I’m a SHOW OFF person”
“Experience Sharing is fun”
Current Status 80% iOS app, 20% Ruby/Rails
100% Ruby Lover!
None
Web Development Conference in Taiwan
None
2 days, 3 tracks session
750+ attendees
all tickets sold out in 4 mins
WebConf Taiwan 2014
Will be held on Jan 2014
850+ attendees in 2014, hopefully.
All about web development
楽しい
http://webconf.tw
Code Reading
Why read source code? How to start? What I learned?
Anything interesting?
Why read source code ?
Ian Ruotsala
http://blog.rubybestpractices.com/posts/gregory/005-code-reading-stdlib.html “once you start digging around in someone else’s code
base, you’ll learn a lot about your own strengths and weaknesses” - Ruby Best Practice
See how the Core Team write Ruby
photo by chaines106 Read the source, Luke!
source http://kyaraben.seesaa.net/article/168967765.html source code は友達
Contribution!
Committer in my dream!
FUN! :)
Requirement ?
C language
“What if I don’t have any skill of C?”
“Just Learn It!”
Curiosity and Passion
Where to Start ?
get source files!
download from Ruby website, or clone from github
Ruby 1.9.2 p290
None
Quick browsing.. :)
* .c + * .h * .rb (stdlib)
Let’s have some fun!
Object Class String Array Hash
“ruby.h”
Object => RObject Class => RClass String => RString Array
=> RArray Hash => RHash
“object.c”
Init_XXXX( )
“all Class’s class is a Class”
“new”
class A def initialize puts "hello" end end a =
A.new
Proc
How to execute a Proc?
proc.call proc[ ] proc.yield proc === 123
attributes
push v.s. <<
Object ID
What else?
Haskell-like syntax :)
head (x:_) = x tail (_:xs) = xs
people = { "Eddie" => ["green", "eddie@digik.com.tw"], "Joanne" => ["yellow",
"hello@yahoo.com"] } people.map { |name, (color, email)| puts [name, email] }
parse.y#8277-8299 shadowing_lvar_gen( ) people = { "Eddie" => ["green", "eddie@digik.com.tw"],
"Joanne" => ["yellow", "hello@yahoo.com"] } people.map { |name, (_, email)| puts [name, email] }
Method missing
Anything interesting ?
Interesting naming.. XD
Conclusion
“from basic structure”
“don’t be afraid of source code”
source http://kyaraben.seesaa.net/article/168967765.html source code は友達
References
http://i.loveruby.net/ja/rhg/book/ “Rubyソースコード完全解説” (RHG) by 青木峰郎
http://patshaughnessy.net/ruby-under-a-microscope “Ruby Under a Microscope” by Pat Shaughnessy
Chimpr Hope we all can become Jedi Master someday :)
高見 龍 です
以上です。 ご清聴ありがとうございました thanks for your listening :)
高見龍 Contacts photo by Eddie Website Blog Plurk Facebook Google
Plus Twitter Email Mobile http://www.eddie.com.tw http://blog.eddie.com.tw http://www.plurk.com/aquarianboy http://www.facebook.com/eddiekao http://www.eddie.com.tw/+ https://twitter.com/#!/eddiekao eddie@digik.com.tw +886-928-617-687