Slide 1

Slide 1 text

分散オブジェクトとは アレですか? SSID: toruby pass: toruby08 Tochigi RubyKaigi 08 Masatoshi SEKI / @m_seki

Slide 2

Slide 2 text

http://www.druby.org/drb20_tork08.pdf ֎ʹग़Εͳ͍࣮श༻ͷωοτϫʔΫ SSID: toruby pass: toruby08 SSID: toruby pass: toruby08

Slide 3

Slide 3 text

Agenda 頃 Workshop SSID: toruby pass: toruby08

Slide 4

Slide 4 text

࡞Γͳ͕Βߟ͑Δͷ͕޷͖ dRuby SSID: toruby pass: toruby08

Slide 5

Slide 5 text

OOPͷϑΝϯλδʔ SSID: toruby pass: toruby08

Slide 6

Slide 6 text

෼ࢄOOPͷϑΝϯλδʔ SSID: toruby pass: toruby08

Slide 7

Slide 7 text

dRubyͰ࡞ͬͨ΋ͷ SSID: toruby pass: toruby08

Slide 8

Slide 8 text

ઌ૆ฦΓ OOP SSID: toruby pass: toruby08

Slide 9

Slide 9 text

Ͱ͖͔ͯΒߟ͑ͨ͜ͱ SSID: toruby pass: toruby08

Slide 10

Slide 10 text

ϓϩηεΛ෼͚Δҙຯ SSID: toruby pass: toruby08

Slide 11

Slide 11 text

dRuby 20th anniversary hands-on workshop @m_seki / [email protected]

Slide 12

Slide 12 text

ॏཁ 2005 ! SSID: toruby pass: toruby08 dRuby ʹΑΔ ؔকढ़ஶ ෼ࢄ ɾ Web ϓϩάϥϛϯά

Slide 13

Slide 13 text

The dRuby Book 2012 Out of print SSID: toruby pass: toruby08

Slide 14

Slide 14 text

HTML൛ެ։த http://www.druby.org/sidruby/ SSID: toruby pass: toruby08

Slide 15

Slide 15 text

Rubyͱࢲ 1999 ERB, dRuby, .... 2000 Perl/RubyConference SSID: toruby pass: toruby08

Slide 16

Slide 16 text

ERB Ruby SSID: toruby pass: toruby08

Slide 17

Slide 17 text

dRuby SSID: toruby pass: toruby08

Slide 18

Slide 18 text

ࠓ೔͸ dRuby 頃 SSID: toruby pass: toruby08

Slide 19

Slide 19 text

ࠓ೔͸ SSID: toruby pass: toruby08

Slide 20

Slide 20 text

RMI Remote Method Invocation SSID: toruby pass: toruby08

Slide 21

Slide 21 text

αʔό Web SSID: toruby pass: toruby08

Slide 22

Slide 22 text

dRuby͸ SSID: toruby pass: toruby08

Slide 23

Slide 23 text

Ruby෩ Web dRuby Ruby Ruby SSID: toruby pass: toruby08

Slide 24

Slide 24 text

ԋश1 Hello, World. SSID: toruby pass: toruby08

Slide 25

Slide 25 text

ԋश1 SSID: toruby pass: toruby08 hello_server.rb hello_client.rb hello() "Hello, World."

Slide 26

Slide 26 text

hello_server.rb require 'drb/drb' class Hello def hello puts('Hello, World.') end end DRb.start_service('druby://localhost:54000', Hello.new) while true sleep 1 end

Slide 27

Slide 27 text

require require 'drb/drb' class Hello def hello puts('Hello, World.') end end DRb.start_service('druby://localhost:54000', Hello.new) sleep

Slide 28

Slide 28 text

DRb.start_service require 'drb/drb' class Hello def hello puts('Hello, World.') end end DRb.start_service('druby://localhost:54000', Hello.new) sleep

Slide 29

Slide 29 text

URI require 'drb/drb' class Hello def hello puts('Hello, World.') end end DRb.start_service('druby://localhost:54000', Hello.new) sleep

Slide 30

Slide 30 text

ऴྃͤ͞ͳ͍ require 'drb/drb' class Hello def hello puts('Hello, World.') end end DRb.start_service('druby://localhost:54000', Hello.new) sleep

Slide 31

Slide 31 text

໿ଋࣄ require 'drb/drb' DRb.start_service URI SSID: toruby pass: toruby08

Slide 32

Slide 32 text

hello_client.rb require 'drb/drb' DRb.start_service ro = DRbObject.new_with_uri('druby://localhost:54000') ro.hello

Slide 33

Slide 33 text

hello_client.rb require 'drb/drb' DRb.start_service ro = DRbObject.new_with_uri('druby://localhost:54000') ro.hello

Slide 34

Slide 34 text

hello_client.rb require 'drb/drb' DRb.start_service ro = DRbObject.new_with_uri('druby://localhost:54000') ro.hello

Slide 35

Slide 35 text

hello_client.rb require 'drb/drb' DRb.start_service ro = DRbObject.new_with_uri('druby://localhost:54000') ro.hello

Slide 36

Slide 36 text

໿ଋࣄ require 'drb/drb' DRb.start_service DRbObject.new_with_uri SSID: toruby pass: toruby08

Slide 37

Slide 37 text

ݩ͸͜Ε class Hello def hello puts('Hello, World.') end end ro = Hello.new ro.hello

Slide 38

Slide 38 text

require 'drb/drb' DRb.start_service ro = DRbObject.new_with_uri('druby://localhost:54000') ro.hello require 'drb/drb' class Hello def hello puts('Hello, World.') end end DRb.start_service('druby://localhost:54000', Hello.new) sleep

Slide 39

Slide 39 text

ԋश1 hello_client.rb hello_server.rb hello_client.rb SSID: toruby pass: toruby08

Slide 40

Slide 40 text

ԋश2 (Hash) SSID: toruby pass: toruby08

Slide 41

Slide 41 text

Hash ( ) Array ( ) SSID: toruby pass: toruby08

Slide 42

Slide 42 text

hash_server.rb require 'drb/drb' require 'pp' front = Hash.new DRb.start_service('druby://localhost:54300', front) while true sleep 10 pp front end

Slide 43

Slide 43 text

ԋश2 SSID: toruby pass: toruby08 hash_server.rb irb irb

Slide 44

Slide 44 text

ԋश2 "String" 2012 Time.now $stdout SSID: toruby pass: toruby08

Slide 45

Slide 45 text

CGIͷྫ SSID: toruby pass: toruby08 CGI Web App CGI CGI CGI long lifetime short lifetime

Slide 46

Slide 46 text

WEBrickʹΑΔΞϓϦ WEBrick HTTP CGI SSID: toruby pass: toruby08

Slide 47

Slide 47 text

WEBrick::CGI require 'webrick/cgi' class MyCGI < WEBrick::CGI def do_GET(req, res) res["content-type"] = "text/plain" ret = "hoge\n" res.body = ret end end MyCGI.new.start()

Slide 48

Slide 48 text

start WEBrick::CGI#start(env = ENV, stdin = $stdin, stdout = $stdout)

Slide 49

Slide 49 text

startϝιου $stdin, $stdout SSID: toruby pass: toruby08

Slide 50

Slide 50 text

m_seki's cgi require 'drb/drb' DRb.start_service('druby://localhost:0') ro = DRbObject.new_with_uri('druby://localhost:50830') ro.start(ENV.to_hash, $stdin, $stdout)

Slide 51

Slide 51 text

startͷΑ͏͢ SSID: toruby pass: toruby08 CGI Web App $stdin.read $stdout.write start(env, $stdin, $stdout)

Slide 52

Slide 52 text

Δͼ·40߸ SSID: toruby pass: toruby08

Slide 53

Slide 53 text

ԋश6 Shi-ri-to-ri SSID: toruby pass: toruby08

Slide 54

Slide 54 text

·ͱΊ dRuby SSID: toruby pass: toruby08

Slide 55

Slide 55 text

;Γ͔͑Γ SSID: toruby pass: toruby08