SlideShare a Scribd company logo
1 of 86
Download to read offline
高見 龍 です
高 見龍 です
@eddiekao
Code Reading
Learning more about Ruby by Reading Ruby Source Code
Chimpr
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
I’m a Flash guy (≈ 8 years)
I’m a Python guy (≈ 2 years)
I’m a Ruby guy (≈ 4 years)
I’m a iOS app guy (≈ 2 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!
Web Development Conference in Taiwan
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
“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
http://blog.rubybestpractices.com/posts/gregory/005-code-reading-stdlib.html
See how the Core Team write Ruby
Read the source, Luke!
photo by chaines106
source code は友達
source http://kyaraben.seesaa.net/article/168967765.html
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
Quick browsing.. :)
*c + *h
. .
*rb (stdlib)
.
Let’s have some fun!
Object
Class
String
Hash

Array
“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]
}
people = {
"Eddie" => ["green", "eddie@digik.com.tw"],
"Joanne" => ["yellow", "hello@yahoo.com"]
}
people.map { |name, (_, email)|
puts [name, email]
}
parse.y#8277-8299 shadowing_lvar_gen( )
Method missing
Anything interesting ?
Interesting naming.. XD
Conclusion
“from basic structure”
“don’t be afraid of source code”
source code は友達
source http://kyaraben.seesaa.net/article/168967765.html
References
“Rubyソースコード完全解説” (RHG)
by 青木峰郎
http://i.loveruby.net/ja/rhg/book/
“Ruby Under a Microscope”
by Pat Shaughnessy
http://patshaughnessy.net/ruby-under-a-microscope
Hope we all can become
Jedi Master someday :)
Chimpr
高見 龍 です
以上です。
ご清聴ありがとうございました

thanks for your listening :)
Contacts
高見龍

Website

http://www.eddie.com.tw

Blog

http://blog.eddie.com.tw

Plurk

http://www.plurk.com/aquarianboy

Facebook

http://www.facebook.com/eddiekao

Google Plus

http://www.eddie.com.tw/+

Twitter

https://twitter.com/#!/eddiekao

Email

eddie@digik.com.tw

Mobile

+886-928-617-687

photo by Eddie

More Related Content

Similar to Code Reading

Sinatra: прошлое, будущее и настоящее
Sinatra: прошлое, будущее и настоящееSinatra: прошлое, будущее и настоящее
Sinatra: прошлое, будущее и настоящее.toster
 
Ruby Programming Language - Introduction
Ruby Programming Language - IntroductionRuby Programming Language - Introduction
Ruby Programming Language - IntroductionKwangshin Oh
 
How to Begin to Develop Ruby Core
How to Begin to Develop Ruby CoreHow to Begin to Develop Ruby Core
How to Begin to Develop Ruby CoreHiroshi SHIBATA
 
Scala : language of the future
Scala : language of the futureScala : language of the future
Scala : language of the futureAnsviaLab
 
The story of language development
The story of language developmentThe story of language development
The story of language developmentHiroshi SHIBATA
 
NodeHack 02 - socket.io workshop
NodeHack 02 - socket.io workshopNodeHack 02 - socket.io workshop
NodeHack 02 - socket.io workshopRaj Rajandran
 
plackdo, plack-like web interface on perl6
plackdo, plack-like web interface on perl6plackdo, plack-like web interface on perl6
plackdo, plack-like web interface on perl6Nobuo Danjou
 
Ruby for Java Developers
Ruby for Java DevelopersRuby for Java Developers
Ruby for Java DevelopersRobert Reiz
 
Hybrid concurrency patterns
Hybrid concurrency patternsHybrid concurrency patterns
Hybrid concurrency patternsKyle Drake
 
萌典與零時政府
萌典與零時政府萌典與零時政府
萌典與零時政府Au Tang
 
WebSocket For Web Rubyists
WebSocket For Web RubyistsWebSocket For Web Rubyists
WebSocket For Web RubyistsMu-Fan Teng
 
Learning To Walk In Shoes
Learning To Walk In ShoesLearning To Walk In Shoes
Learning To Walk In ShoesBrian Hogan
 

Similar to Code Reading (20)

Sinatra: прошлое, будущее и настоящее
Sinatra: прошлое, будущее и настоящееSinatra: прошлое, будущее и настоящее
Sinatra: прошлое, будущее и настоящее
 
Week10
Week10Week10
Week10
 
IJTC%202009%20JRuby
IJTC%202009%20JRubyIJTC%202009%20JRuby
IJTC%202009%20JRuby
 
IJTC%202009%20JRuby
IJTC%202009%20JRubyIJTC%202009%20JRuby
IJTC%202009%20JRuby
 
Ruby Programming Language - Introduction
Ruby Programming Language - IntroductionRuby Programming Language - Introduction
Ruby Programming Language - Introduction
 
How to Begin to Develop Ruby Core
How to Begin to Develop Ruby CoreHow to Begin to Develop Ruby Core
How to Begin to Develop Ruby Core
 
Scala : language of the future
Scala : language of the futureScala : language of the future
Scala : language of the future
 
Ruby Kaigi 2008 LT
Ruby Kaigi 2008 LTRuby Kaigi 2008 LT
Ruby Kaigi 2008 LT
 
Intro to Rails
Intro to RailsIntro to Rails
Intro to Rails
 
Children of Ruby
Children of RubyChildren of Ruby
Children of Ruby
 
About Clack
About ClackAbout Clack
About Clack
 
The story of language development
The story of language developmentThe story of language development
The story of language development
 
NodeHack 02 - socket.io workshop
NodeHack 02 - socket.io workshopNodeHack 02 - socket.io workshop
NodeHack 02 - socket.io workshop
 
plackdo, plack-like web interface on perl6
plackdo, plack-like web interface on perl6plackdo, plack-like web interface on perl6
plackdo, plack-like web interface on perl6
 
Ruby for Java Developers
Ruby for Java DevelopersRuby for Java Developers
Ruby for Java Developers
 
Hybrid concurrency patterns
Hybrid concurrency patternsHybrid concurrency patterns
Hybrid concurrency patterns
 
萌典與零時政府
萌典與零時政府萌典與零時政府
萌典與零時政府
 
WebSocket For Web Rubyists
WebSocket For Web RubyistsWebSocket For Web Rubyists
WebSocket For Web Rubyists
 
Learning To Walk In Shoes
Learning To Walk In ShoesLearning To Walk In Shoes
Learning To Walk In Shoes
 
Week2
Week2Week2
Week2
 

More from Eddie Kao

Rails girls in Taipei
Rails girls in TaipeiRails girls in Taipei
Rails girls in TaipeiEddie Kao
 
Rails Girls in Taipei
Rails Girls in TaipeiRails Girls in Taipei
Rails Girls in TaipeiEddie Kao
 
Let's Learn Ruby - Basic
Let's Learn Ruby - BasicLet's Learn Ruby - Basic
Let's Learn Ruby - BasicEddie Kao
 
iOS app development and Open Source
iOS app development and Open SourceiOS app development and Open Source
iOS app development and Open SourceEddie Kao
 
from Ruby to Objective-C
from Ruby to Objective-Cfrom Ruby to Objective-C
from Ruby to Objective-CEddie Kao
 
CreateJS - from Flash to Javascript
CreateJS - from Flash to JavascriptCreateJS - from Flash to Javascript
CreateJS - from Flash to JavascriptEddie Kao
 
May the source_be_with_you
May the source_be_with_youMay the source_be_with_you
May the source_be_with_youEddie Kao
 
Why I use Vim
Why I use VimWhy I use Vim
Why I use VimEddie Kao
 
There is something about Event
There is something about EventThere is something about Event
There is something about EventEddie Kao
 
Happy Programming with CoffeeScript
Happy Programming with CoffeeScriptHappy Programming with CoffeeScript
Happy Programming with CoffeeScriptEddie Kao
 
Ruby without rails
Ruby without railsRuby without rails
Ruby without railsEddie Kao
 
CoffeeScript-Ruby-Tuesday
CoffeeScript-Ruby-TuesdayCoffeeScript-Ruby-Tuesday
CoffeeScript-Ruby-TuesdayEddie Kao
 
3rd AS Study Group
3rd AS Study Group3rd AS Study Group
3rd AS Study GroupEddie Kao
 
iOS Game Development with Cocos2d
iOS Game Development with Cocos2diOS Game Development with Cocos2d
iOS Game Development with Cocos2dEddie Kao
 
AS3讀書會(行前準備)
AS3讀書會(行前準備)AS3讀書會(行前準備)
AS3讀書會(行前準備)Eddie Kao
 
Misunderstanding about flash
Misunderstanding about flashMisunderstanding about flash
Misunderstanding about flashEddie Kao
 
Refactoring in AS3
Refactoring in AS3Refactoring in AS3
Refactoring in AS3Eddie Kao
 

More from Eddie Kao (20)

Rails girls in Taipei
Rails girls in TaipeiRails girls in Taipei
Rails girls in Taipei
 
Rails Girls in Taipei
Rails Girls in TaipeiRails Girls in Taipei
Rails Girls in Taipei
 
Let's Learn Ruby - Basic
Let's Learn Ruby - BasicLet's Learn Ruby - Basic
Let's Learn Ruby - Basic
 
iOS app development and Open Source
iOS app development and Open SourceiOS app development and Open Source
iOS app development and Open Source
 
Vim
VimVim
Vim
 
from Ruby to Objective-C
from Ruby to Objective-Cfrom Ruby to Objective-C
from Ruby to Objective-C
 
CreateJS - from Flash to Javascript
CreateJS - from Flash to JavascriptCreateJS - from Flash to Javascript
CreateJS - from Flash to Javascript
 
May the source_be_with_you
May the source_be_with_youMay the source_be_with_you
May the source_be_with_you
 
Why I use Vim
Why I use VimWhy I use Vim
Why I use Vim
 
There is something about Event
There is something about EventThere is something about Event
There is something about Event
 
Happy Programming with CoffeeScript
Happy Programming with CoffeeScriptHappy Programming with CoffeeScript
Happy Programming with CoffeeScript
 
Ruby without rails
Ruby without railsRuby without rails
Ruby without rails
 
CoffeeScript-Ruby-Tuesday
CoffeeScript-Ruby-TuesdayCoffeeScript-Ruby-Tuesday
CoffeeScript-Ruby-Tuesday
 
API Design
API DesignAPI Design
API Design
 
3rd AS Study Group
3rd AS Study Group3rd AS Study Group
3rd AS Study Group
 
iOS Game Development with Cocos2d
iOS Game Development with Cocos2diOS Game Development with Cocos2d
iOS Game Development with Cocos2d
 
AS3讀書會(行前準備)
AS3讀書會(行前準備)AS3讀書會(行前準備)
AS3讀書會(行前準備)
 
AMF
AMFAMF
AMF
 
Misunderstanding about flash
Misunderstanding about flashMisunderstanding about flash
Misunderstanding about flash
 
Refactoring in AS3
Refactoring in AS3Refactoring in AS3
Refactoring in AS3
 

Recently uploaded

Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 

Recently uploaded (20)

Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 

Code Reading