SlideShare uma empresa Scribd logo
1 de 46
Baixar para ler offline
RUBY AND JAPANESE
        Makoto Inoue
     LRUG December 2010
WHO ARE WE
 (NORMAL)?
WHO ARE WE(TODAY)?
ME @ RUBYKAIGI



here




       http://image.gihyo.co.jp/assets/images/news/report/01/rubykaigi2010/0003/thumb/TH400_IMG_1253.jpg
TOPIC

Basic Japanese

Object Oriented (OO)

Functional

Japanese Programming in Ruby
BASIC JAPANESE
           Step 1
WATASHI HA RUBY GA SUKI DESU


  Kanji   Katakana   Hiragana

Kanji                    eg:    ,

Katakana                 eg:

Hiragana                eg:     , ,
Hiragana
Katakana




    Each Japanese alphabet is a combination of vowels(a,i,u,e,o) and consonants(k,s,t,n,h,m,y,r,w). Total of Hiragana and
    Katakana are 46 each. The number of possible Kanji in use in Japan is around 50,000 , though around 2000 ~ 3000 are
    in common use.
Kanji => Hiragana
 Kanji
Hiragana
Kanji     Kanji => Katakana

Katakana
WHAT’S YOUR NAME?
           How Japanese
Alphabet     interpret    Katakana Hiragana   Kanji

  Makoto makoto

  Vivian   bibiann

  Oliver   oriba-

  Max      makkusu
BUILD YOUR OWN




   http://kanji-fandom.com/
WHY SO MANY WAYS?


Kanji = To import Chinese words

Hiragana = To suit for domestic use

Katakana = To adopt new words
WHY SO MANY WAYS?


To import OO & Functional

To suit for Scripting

To adopt New Concepts
OBJECT ORIENTED

            Step 2
JAPANESE & OO




http://satoshi.blogs.com/life/2004/09/post.html
ENGLISH (SVO)



   I      like   Ruby

Subject   Verb   Object
(SOV)



Watashi ha Ruby ga Suki desu
 Subject Object   Verb

I Ruby Like
CUI(SVO)
GUI(SOV)
http://satoshi.blogs.com/life/2004/09/post.html
RUBY
# Procedural
open("box")
open("car")

# OO
Box.new.open
Car.new.open
FUNCTIONAL
        Step 3
Japanese is a politician's language



                     Makoto Inoue (Me) - 2010
POLITICIAN....

does not commit to anything unless
necessary

means different things depending on
context
PREPOSITIONS



preposition
noun Grammar
a word governing, and usually preceding, a
noun or pronoun and expressing a relation
to another word or element in the clause,
as in “the man on the platform,” “she
arrived after dinner,” “what did you do it
for you
POSTPOSITIONS



postposition
noun Grammar
a word or morpheme placed after the
word it governs, for example -ward in
homeward.
POSTPOSITIONS IN JAPANESE



   S        O
Watashi ha Ruby ga Suki desu(I Ruby Like)


       O             S
Ruby ga Watashi ha Suki desu(Ruby I Like)


       O
Ruby ga Suki desu(Ruby Like)
                Postposition is used to decide the role of noun which it supports. This enables you to
                change the order of structure very flexibly, chain as many sentence as you like, and
                also let you to omit subject.
ABUSING POSTPOSITIONS

              Don’t Read !!
  ”




      ”    Confusing, vague, and long
          sentence without much point
              (Could be powerful)
FUNCTIONAL



Lazy evaluation

high order function
RUBY


                               % 10000.times
Enumerable                     => #<Enumerator: 10000:times>


Arel User.order('users.id   DESC').limit(20).includes(:items)


Block   File.open("/tmp.txt").each do
        |line|
            puts line
        end
JAPANESE PROGRAMMING IN RUBY

RUBY
1.9
      https://github.com/makoto/japanize   Step 4
DEMO
http://screenr.com/F9L
GRAMMAR

# -*- encoding: utf-8 -*-
module Japanize
  module Grammar
    VERBS = {
      '   ' => :+,   # tasu
     '    ' => :-,   # hiku
     '     ' => :*, # kakeru
     '    ' => :/,   # waru
   }
   POSTPOSITIONAL_PARTICLES = ['     ','   ','   ','   ']
   def   ; POSTPOSITIONAL_PARTICLES; end
   def   ; NUMBERS; end
   def   ; VERBS; end
GRAMMAR

# -*- encoding: utf-8 -*-
def parse
  @sequence.split('').map do |s|
    s.split(/#{   .join("|")}/)
  end.flatten.map do |s|
    if    [s]
        [s]
    elsif     [s[0]]
      NumberConverter.convert(s)
    end
  end
end
PARSER


# -*- encoding: utf-8 -*-
describe Parser do
  it "must divide a phrase into words" do
    Parser.new("                    ").
        parse.must_equal [1, 2, :+, 4, :*]
  end
end
GOOGLE TRANSLATION
EVALUATOR



describe Evaluator do
  it "must calculate all operands" do
    Evaluator.new([1, 2, :+, 3 , :* , 1, :-, 2, :/]).
      evaluate.must_equal ((((1+2) * 3) - 1 ) / 2)
  end
end
REVERSE POLISH NOTATION




       [1, 2, :+, 3 , :* , 1, :-, 2, :/]




http://en.wikipedia.org/wiki/Reverse_Polish_notation
RubiMaVM
      RUBY VM ON RUBY




http://jp.rubyist.net/magazine/?0007-YarvManiacs
METHOD MISSING

# -*- encoding: utf-8 -*-
def method_missing (*obj)
  if    [obj[0][0]]
    parsed = Parser.new(obj[0].to_s).parse
    Evaluator.new(parsed).evaluate
  else
    super
  end
end
SO WHAT?
           :-)
WHY SO MANY WAYS?


To import OO & Functional

To suit for Scripting

To adopt New Concepts
MATZ @
         SAPPORO RUBY KAIGI
        http://regional.rubykaigi.org/sapporo03




”In future, I want Ruby to keep being the light
which brings new    concepts and ideas to people.
I also would like people to see such light, add their
own, and spread it to other people.”
                            http://igarashikuniaki.net/tdiary/20101205.html
WHAT CAN YOU DO?
                                                       http://www.igvita.com/2010/12/02/concurrency-with-actors-goroutines-ruby/




http://www.pragprog.com/titles/btlang/seven-languages-in-seven-weeks




                                                                http://www.rubyinside.com/ruby-refinements-an-overview-of-a-new-proposed-ruby-feature-3978.html
                 http://rubykaigi.org/2011/en
MERRY CHRISTMAS &
HAVE A HAPPY NEW YEAR!!
            &        !!
   hello 2011




      http://www.railsonwave.com/assets/2006/12/21/screensaver_1.jpg

Mais conteúdo relacionado

Mais procurados

Copy & Pest - A case-study on the clipboard, blind trust and invisible cross-...
Copy & Pest - A case-study on the clipboard, blind trust and invisible cross-...Copy & Pest - A case-study on the clipboard, blind trust and invisible cross-...
Copy & Pest - A case-study on the clipboard, blind trust and invisible cross-...
Mario Heiderich
 
Hacking liferay
Hacking liferayHacking liferay
Hacking liferay
Armel Nene
 

Mais procurados (20)

Aula 01 - Curso GRATUITO EAD de Desenvolvimento Seguro de Software com Alcyon...
Aula 01 - Curso GRATUITO EAD de Desenvolvimento Seguro de Software com Alcyon...Aula 01 - Curso GRATUITO EAD de Desenvolvimento Seguro de Software com Alcyon...
Aula 01 - Curso GRATUITO EAD de Desenvolvimento Seguro de Software com Alcyon...
 
Clean code
Clean code Clean code
Clean code
 
Clean code
Clean codeClean code
Clean code
 
Android Security Internals
Android Security InternalsAndroid Security Internals
Android Security Internals
 
Copy & Pest - A case-study on the clipboard, blind trust and invisible cross-...
Copy & Pest - A case-study on the clipboard, blind trust and invisible cross-...Copy & Pest - A case-study on the clipboard, blind trust and invisible cross-...
Copy & Pest - A case-study on the clipboard, blind trust and invisible cross-...
 
02.모의해킹전문가되기
02.모의해킹전문가되기02.모의해킹전문가되기
02.모의해킹전문가되기
 
An Overview of Deserialization Vulnerabilities in the Java Virtual Machine (J...
An Overview of Deserialization Vulnerabilities in the Java Virtual Machine (J...An Overview of Deserialization Vulnerabilities in the Java Virtual Machine (J...
An Overview of Deserialization Vulnerabilities in the Java Virtual Machine (J...
 
APT Saldırıları
APT SaldırılarıAPT Saldırıları
APT Saldırıları
 
From Web to Flux @DevoxxBE 2023.pptx
From Web to Flux @DevoxxBE 2023.pptxFrom Web to Flux @DevoxxBE 2023.pptx
From Web to Flux @DevoxxBE 2023.pptx
 
Offensive Payment Security
Offensive Payment SecurityOffensive Payment Security
Offensive Payment Security
 
OWASP API Security Top 10 Examples
OWASP API Security Top 10 ExamplesOWASP API Security Top 10 Examples
OWASP API Security Top 10 Examples
 
Hacking with Remote Admin Tools (RAT)
 Hacking with Remote Admin Tools (RAT) Hacking with Remote Admin Tools (RAT)
Hacking with Remote Admin Tools (RAT)
 
Introduction to go language programming
Introduction to go language programmingIntroduction to go language programming
Introduction to go language programming
 
Clean coding-practices
Clean coding-practicesClean coding-practices
Clean coding-practices
 
SIEM KORELASYON MOTORU DEĞERLENDİRME KRİTERLERİ
SIEM KORELASYON MOTORU DEĞERLENDİRME KRİTERLERİSIEM KORELASYON MOTORU DEĞERLENDİRME KRİTERLERİ
SIEM KORELASYON MOTORU DEĞERLENDİRME KRİTERLERİ
 
Hacking liferay
Hacking liferayHacking liferay
Hacking liferay
 
Aula 03 - Curso GRATUITO EAD de Desenvolvimento Seguro de Software com Alcyon...
Aula 03 - Curso GRATUITO EAD de Desenvolvimento Seguro de Software com Alcyon...Aula 03 - Curso GRATUITO EAD de Desenvolvimento Seguro de Software com Alcyon...
Aula 03 - Curso GRATUITO EAD de Desenvolvimento Seguro de Software com Alcyon...
 
Race condition
Race conditionRace condition
Race condition
 
Hacking the swisscom modem
Hacking the swisscom modemHacking the swisscom modem
Hacking the swisscom modem
 
Improving Automated Tests with Fluent Assertions
Improving Automated Tests with Fluent Assertions Improving Automated Tests with Fluent Assertions
Improving Automated Tests with Fluent Assertions
 

Destaque

Sinsai info-makoto-draft-1
Sinsai info-makoto-draft-1Sinsai info-makoto-draft-1
Sinsai info-makoto-draft-1
Makoto Inoue
 
Double consonants in Katakana
Double consonants in KatakanaDouble consonants in Katakana
Double consonants in Katakana
Accura Kurosawa
 
Hiragana 1 28 páginas imprimir yuko
Hiragana 1 28 páginas imprimir yukoHiragana 1 28 páginas imprimir yuko
Hiragana 1 28 páginas imprimir yuko
Zene Lundgren
 

Destaque (13)

Sinsai info-makoto-draft-1
Sinsai info-makoto-draft-1Sinsai info-makoto-draft-1
Sinsai info-makoto-draft-1
 
Introduction to ruby eval
Introduction to ruby evalIntroduction to ruby eval
Introduction to ruby eval
 
Feudal Japan
Feudal JapanFeudal Japan
Feudal Japan
 
Double consonants in Katakana
Double consonants in KatakanaDouble consonants in Katakana
Double consonants in Katakana
 
Katakana quiz 2
Katakana quiz 2Katakana quiz 2
Katakana quiz 2
 
HS Japanese Students 's work
HS Japanese Students 's workHS Japanese Students 's work
HS Japanese Students 's work
 
Japanese writing
Japanese writingJapanese writing
Japanese writing
 
Hiragana 1 28 páginas imprimir yuko
Hiragana 1 28 páginas imprimir yukoHiragana 1 28 páginas imprimir yuko
Hiragana 1 28 páginas imprimir yuko
 
Eng016
Eng016Eng016
Eng016
 
How to Write Your Name in Japanese
How to Write Your Name in JapaneseHow to Write Your Name in Japanese
How to Write Your Name in Japanese
 
Learning Japanese
Learning JapaneseLearning Japanese
Learning Japanese
 
Session 1 What is Japanese?
Session 1 What is Japanese?Session 1 What is Japanese?
Session 1 What is Japanese?
 
Railsチュートリアルの歩き方 (第4版)
Railsチュートリアルの歩き方 (第4版)Railsチュートリアルの歩き方 (第4版)
Railsチュートリアルの歩き方 (第4版)
 

Semelhante a Ruby and japanese

Ruby on Rails - Pengenalan kepada “permata” dalam pengaturcaraan
Ruby on Rails - Pengenalan kepada “permata” dalam pengaturcaraan  Ruby on Rails - Pengenalan kepada “permata” dalam pengaturcaraan
Ruby on Rails - Pengenalan kepada “permata” dalam pengaturcaraan
edthix
 
ruby_vs_perl_and_python
ruby_vs_perl_and_pythonruby_vs_perl_and_python
ruby_vs_perl_and_python
tutorialsruby
 
ruby_vs_perl_and_python
ruby_vs_perl_and_pythonruby_vs_perl_and_python
ruby_vs_perl_and_python
tutorialsruby
 
Ruby -the wheel Technology
Ruby -the wheel TechnologyRuby -the wheel Technology
Ruby -the wheel Technology
ppparthpatel123
 

Semelhante a Ruby and japanese (20)

Ruby
RubyRuby
Ruby
 
Ruby on Rails - Pengenalan kepada “permata” dalam pengaturcaraan
Ruby on Rails - Pengenalan kepada “permata” dalam pengaturcaraan  Ruby on Rails - Pengenalan kepada “permata” dalam pengaturcaraan
Ruby on Rails - Pengenalan kepada “permata” dalam pengaturcaraan
 
Ruby for Java Developers
Ruby for Java DevelopersRuby for Java Developers
Ruby for Java Developers
 
ruby_vs_perl_and_python
ruby_vs_perl_and_pythonruby_vs_perl_and_python
ruby_vs_perl_and_python
 
ruby_vs_perl_and_python
ruby_vs_perl_and_pythonruby_vs_perl_and_python
ruby_vs_perl_and_python
 
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
 
roofimon@njug5
roofimon@njug5roofimon@njug5
roofimon@njug5
 
Make Your Ruby Script Confusing
Make Your Ruby Script ConfusingMake Your Ruby Script Confusing
Make Your Ruby Script Confusing
 
Ruby -the wheel Technology
Ruby -the wheel TechnologyRuby -the wheel Technology
Ruby -the wheel Technology
 
Intro to Ruby (and RSpec)
Intro to Ruby (and RSpec)Intro to Ruby (and RSpec)
Intro to Ruby (and RSpec)
 
Ruby seen by a C# developer
Ruby seen by a C# developerRuby seen by a C# developer
Ruby seen by a C# developer
 
Ruby seen from a C# developer
Ruby seen from a C# developerRuby seen from a C# developer
Ruby seen from a C# developer
 
#CNX14 - Using Ruby for Reliability, Consistency, and Speed
#CNX14 - Using Ruby for Reliability, Consistency, and Speed#CNX14 - Using Ruby for Reliability, Consistency, and Speed
#CNX14 - Using Ruby for Reliability, Consistency, and Speed
 
How DSL works on Ruby
How DSL works on RubyHow DSL works on Ruby
How DSL works on Ruby
 
Introduction to Ruby
Introduction to RubyIntroduction to Ruby
Introduction to Ruby
 
Functional programming is the most extreme programming
Functional programming is the most extreme programmingFunctional programming is the most extreme programming
Functional programming is the most extreme programming
 
A Recovering Java Developer Learns to Go
A Recovering Java Developer Learns to GoA Recovering Java Developer Learns to Go
A Recovering Java Developer Learns to Go
 
Plataforma java
Plataforma javaPlataforma java
Plataforma java
 
Make Your Own Tools
Make Your Own ToolsMake Your Own Tools
Make Your Own Tools
 
ppt7
ppt7ppt7
ppt7
 

Mais de Makoto Inoue (14)

Video learningtech
Video learningtechVideo learningtech
Video learningtech
 
StepUpYouTuber
StepUpYouTuberStepUpYouTuber
StepUpYouTuber
 
StepUp 4pt5
StepUp 4pt5StepUp 4pt5
StepUp 4pt5
 
Benkyo player dnle2
Benkyo player dnle2Benkyo player dnle2
Benkyo player dnle2
 
Data viz as interface #ignitelondon7
Data viz as interface #ignitelondon7Data viz as interface #ignitelondon7
Data viz as interface #ignitelondon7
 
Data viz as_interface_makoto_inoue
Data viz as_interface_makoto_inoueData viz as_interface_makoto_inoue
Data viz as_interface_makoto_inoue
 
Programming 101 w_storify_api
Programming 101 w_storify_apiProgramming 101 w_storify_api
Programming 101 w_storify_api
 
Programming 101 w_storify_api
Programming 101 w_storify_apiProgramming 101 w_storify_api
Programming 101 w_storify_api
 
Sinsai info-rubykaigi
Sinsai info-rubykaigiSinsai info-rubykaigi
Sinsai info-rubykaigi
 
Sinsai devnest
Sinsai devnestSinsai devnest
Sinsai devnest
 
euruko
eurukoeuruko
euruko
 
euruko2
euruko2euruko2
euruko2
 
Node Js Websocket Js Meetup Slides
Node Js Websocket Js Meetup SlidesNode Js Websocket Js Meetup Slides
Node Js Websocket Js Meetup Slides
 
Rhodes And Phone Gap
Rhodes And Phone GapRhodes And Phone Gap
Rhodes And Phone Gap
 

Ruby and japanese