SlideShare ist ein Scribd-Unternehmen logo
1 von 46
Downloaden Sie, um offline zu lesen
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

Weitere ähnliche Inhalte

Was ist angesagt?

The lazy programmer's guide to writing thousands of tests
The lazy programmer's guide to writing thousands of testsThe lazy programmer's guide to writing thousands of tests
The lazy programmer's guide to writing thousands of testsScott Wlaschin
 
Java 8 presentation
Java 8 presentationJava 8 presentation
Java 8 presentationVan Huong
 
20.3 Java encapsulation
20.3 Java encapsulation20.3 Java encapsulation
20.3 Java encapsulationIntro C# Book
 
Jetpack Compose a nova forma de implementar UI no Android
Jetpack Compose a nova forma de implementar UI no AndroidJetpack Compose a nova forma de implementar UI no Android
Jetpack Compose a nova forma de implementar UI no AndroidNelson Glauber Leal
 
Java 8 Lambda Built-in Functional Interfaces
Java 8 Lambda Built-in Functional InterfacesJava 8 Lambda Built-in Functional Interfaces
Java 8 Lambda Built-in Functional InterfacesGanesh Samarthyam
 
Java - Collections framework
Java - Collections frameworkJava - Collections framework
Java - Collections frameworkRiccardo Cardin
 
Introduction to JPA and Hibernate including examples
Introduction to JPA and Hibernate including examplesIntroduction to JPA and Hibernate including examples
Introduction to JPA and Hibernate including examplesecosio GmbH
 
Building RESTful applications using Spring MVC
Building RESTful applications using Spring MVCBuilding RESTful applications using Spring MVC
Building RESTful applications using Spring MVCIndicThreads
 
Kiss PageObjects [01-2017]
Kiss PageObjects [01-2017]Kiss PageObjects [01-2017]
Kiss PageObjects [01-2017]Iakiv Kramarenko
 
The Functional Programmer's Toolkit (NDC London 2019)
The Functional Programmer's Toolkit (NDC London 2019)The Functional Programmer's Toolkit (NDC London 2019)
The Functional Programmer's Toolkit (NDC London 2019)Scott Wlaschin
 
Quill vs Slick Smackdown
Quill vs Slick SmackdownQuill vs Slick Smackdown
Quill vs Slick SmackdownAlexander Ioffe
 
The Power of Composition (NDC Oslo 2020)
The Power of Composition (NDC Oslo 2020)The Power of Composition (NDC Oslo 2020)
The Power of Composition (NDC Oslo 2020)Scott Wlaschin
 
Domain Modeling Made Functional (KanDDDinsky 2019)
Domain Modeling Made Functional (KanDDDinsky 2019)Domain Modeling Made Functional (KanDDDinsky 2019)
Domain Modeling Made Functional (KanDDDinsky 2019)Scott Wlaschin
 
20.4 Java interfaces and abstraction
20.4 Java interfaces and abstraction20.4 Java interfaces and abstraction
20.4 Java interfaces and abstractionIntro C# Book
 

Was ist angesagt? (20)

The lazy programmer's guide to writing thousands of tests
The lazy programmer's guide to writing thousands of testsThe lazy programmer's guide to writing thousands of tests
The lazy programmer's guide to writing thousands of tests
 
Networking in Java
Networking in JavaNetworking in Java
Networking in Java
 
Java 8 presentation
Java 8 presentationJava 8 presentation
Java 8 presentation
 
20.3 Java encapsulation
20.3 Java encapsulation20.3 Java encapsulation
20.3 Java encapsulation
 
Jetpack Compose a nova forma de implementar UI no Android
Jetpack Compose a nova forma de implementar UI no AndroidJetpack Compose a nova forma de implementar UI no Android
Jetpack Compose a nova forma de implementar UI no Android
 
Java 8 Lambda Built-in Functional Interfaces
Java 8 Lambda Built-in Functional InterfacesJava 8 Lambda Built-in Functional Interfaces
Java 8 Lambda Built-in Functional Interfaces
 
Java - Collections framework
Java - Collections frameworkJava - Collections framework
Java - Collections framework
 
Introduction to JPA and Hibernate including examples
Introduction to JPA and Hibernate including examplesIntroduction to JPA and Hibernate including examples
Introduction to JPA and Hibernate including examples
 
Building RESTful applications using Spring MVC
Building RESTful applications using Spring MVCBuilding RESTful applications using Spring MVC
Building RESTful applications using Spring MVC
 
Kiss PageObjects [01-2017]
Kiss PageObjects [01-2017]Kiss PageObjects [01-2017]
Kiss PageObjects [01-2017]
 
Optional in Java 8
Optional in Java 8Optional in Java 8
Optional in Java 8
 
The Functional Programmer's Toolkit (NDC London 2019)
The Functional Programmer's Toolkit (NDC London 2019)The Functional Programmer's Toolkit (NDC London 2019)
The Functional Programmer's Toolkit (NDC London 2019)
 
Quill vs Slick Smackdown
Quill vs Slick SmackdownQuill vs Slick Smackdown
Quill vs Slick Smackdown
 
User defined functions
User defined functionsUser defined functions
User defined functions
 
Clean coding-practices
Clean coding-practicesClean coding-practices
Clean coding-practices
 
The Power of Composition (NDC Oslo 2020)
The Power of Composition (NDC Oslo 2020)The Power of Composition (NDC Oslo 2020)
The Power of Composition (NDC Oslo 2020)
 
Domain Modeling Made Functional (KanDDDinsky 2019)
Domain Modeling Made Functional (KanDDDinsky 2019)Domain Modeling Made Functional (KanDDDinsky 2019)
Domain Modeling Made Functional (KanDDDinsky 2019)
 
Java collections
Java collectionsJava collections
Java collections
 
Spring jdbc
Spring jdbcSpring jdbc
Spring jdbc
 
20.4 Java interfaces and abstraction
20.4 Java interfaces and abstraction20.4 Java interfaces and abstraction
20.4 Java interfaces and abstraction
 

Andere mochten auch

Sinsai info-makoto-draft-1
Sinsai info-makoto-draft-1Sinsai info-makoto-draft-1
Sinsai info-makoto-draft-1Makoto Inoue
 
Introduction to ruby eval
Introduction to ruby evalIntroduction to ruby eval
Introduction to ruby evalNiranjan Sarade
 
Feudal Japan
Feudal JapanFeudal Japan
Feudal JapanRey Belen
 
Double consonants in Katakana
Double consonants in KatakanaDouble consonants in Katakana
Double consonants in KatakanaAccura Kurosawa
 
HS Japanese Students 's work
HS Japanese Students 's workHS Japanese Students 's work
HS Japanese Students 's workritsu shimizu
 
Japanese writing
Japanese writingJapanese writing
Japanese writingLAUSD
 
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 yukoZene Lundgren
 
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 JapaneseZen Sensei
 
Railsチュートリアルの歩き方 (第4版)
Railsチュートリアルの歩き方 (第4版)Railsチュートリアルの歩き方 (第4版)
Railsチュートリアルの歩き方 (第4版)Yohei Yasukawa
 

Andere mochten auch (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版)
 

Ähnlich wie 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 for Java Developers
Ruby for Java DevelopersRuby for Java Developers
Ruby for Java DevelopersRobert Reiz
 
ruby_vs_perl_and_python
ruby_vs_perl_and_pythonruby_vs_perl_and_python
ruby_vs_perl_and_pythontutorialsruby
 
ruby_vs_perl_and_python
ruby_vs_perl_and_pythonruby_vs_perl_and_python
ruby_vs_perl_and_pythontutorialsruby
 
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
 
Make Your Ruby Script Confusing
Make Your Ruby Script ConfusingMake Your Ruby Script Confusing
Make Your Ruby Script ConfusingSATOSHI TAGOMORI
 
Ruby -the wheel Technology
Ruby -the wheel TechnologyRuby -the wheel Technology
Ruby -the wheel Technologyppparthpatel123
 
Intro to Ruby (and RSpec)
Intro to Ruby (and RSpec)Intro to Ruby (and RSpec)
Intro to Ruby (and RSpec)Blazing Cloud
 
Ruby seen by a C# developer
Ruby seen by a C# developerRuby seen by a C# developer
Ruby seen by a C# developerEmanuele DelBono
 
Ruby seen from a C# developer
Ruby seen from a C# developerRuby seen from a C# developer
Ruby seen from a C# developerCodemotion
 
#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 SpeedSalesforce Marketing Cloud
 
Introduction to Ruby
Introduction to RubyIntroduction to Ruby
Introduction to RubyMark Menard
 
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 programmingsamthemonad
 
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 GoMatt Stine
 

Ähnlich wie 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
 

Mehr von Makoto Inoue

Video learningtech
Video learningtechVideo learningtech
Video learningtechMakoto Inoue
 
Benkyo player dnle2
Benkyo player dnle2Benkyo player dnle2
Benkyo player dnle2Makoto Inoue
 
Data viz as interface #ignitelondon7
Data viz as interface #ignitelondon7Data viz as interface #ignitelondon7
Data viz as interface #ignitelondon7Makoto Inoue
 
Data viz as_interface_makoto_inoue
Data viz as_interface_makoto_inoueData viz as_interface_makoto_inoue
Data viz as_interface_makoto_inoueMakoto Inoue
 
Programming 101 w_storify_api
Programming 101 w_storify_apiProgramming 101 w_storify_api
Programming 101 w_storify_apiMakoto Inoue
 
Programming 101 w_storify_api
Programming 101 w_storify_apiProgramming 101 w_storify_api
Programming 101 w_storify_apiMakoto Inoue
 
Sinsai info-rubykaigi
Sinsai info-rubykaigiSinsai info-rubykaigi
Sinsai info-rubykaigiMakoto Inoue
 
Node Js Websocket Js Meetup Slides
Node Js Websocket Js Meetup SlidesNode Js Websocket Js Meetup Slides
Node Js Websocket Js Meetup SlidesMakoto Inoue
 
Rhodes And Phone Gap
Rhodes And Phone GapRhodes And Phone Gap
Rhodes And Phone GapMakoto Inoue
 

Mehr von 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