SlideShare une entreprise Scribd logo
1  sur  26
Télécharger pour lire hors ligne
Write a program that prints the numbers from 1 to 100. But for
multiples of three print “Fizz” instead of the number and for the
multiples of five print “Buzz”. For numbers which are multiples of
both three and five print “FizzBuzz”.


1       100
3                                            Fizz          5
 Buzz                          3     5                                    FizzBuzz




         http://tickletux.wordpress.com/2007/01/24/using-fizzbuzz-to-find-developers-who-grok-coding/
         http://www.aoky.net/articles/jeff_atwood/why_cant_programmers_program.htm
http://www.cs.is.saga-u.ac.jp/~nakayama07/sotsuken.html
Map

      Last Recently Used (LRU) Cache



                   Map
#
lru.put(“a”, “dataA”);
lru.put(“b”, “dataB”);
lru.put(“c”, “dataC”);
lru.get(“a”); #=> null


# get
lru.put(“a”, “dataA”);
lru.put(“b”, “dataB”);
lru.get(“a”); #=> “dataA”
lru.put(“c”, “dataC”);
lru.get(“b”); #=> null
LRU Cache   ?



(   …)
LRU Cache   ?



(   …)
LRU Cache



(   …)
s = FileStore.new
s.set(“foo”, “hoge”)
s.get(“foo”)      #=> “hoge”
s.dump            #=> “foo:hoge¥n”

s.set(“bar”, “fuga”)
s.dump            #=> “foo:hoge¥nbar:fuga¥n”

s.get(“toto”)       #=> nil

s.set(nil, “momo”) # nil
s.set(“”, “gogo”)     #
s.dump              #=> “foo:hoge¥nbar:fuga¥n”

s.set(“foo”, “piyo”)
s.dump            #=> “bar:fuga¥nfoo:piyo¥n”
FileStore            ?



         (             …)




void : set_multi(Map)
Map : get_multi(Array)

s.set_multi({‘foo’ => ‘hoge’, ‘bar’ => ‘fuga’})
s.get_multi([‘foo’, ‘bar’, ‘baz’]) #=> {‘foo’ => ‘hoge’, ‘bar’ => ‘fuga’}
FileStore   ?



       (           …)




s.set(“foo”, “${now}”) #=> ${now}
s.get(“foo”) #=> “2010-07-10 14:19:12”
FileStore



        (               …)




set(key, val, second)            (           )
set(key, val, Time)          (           )
#            1
s.set_multi({‘foo’ => ‘hoge’, ‘bar’ => ‘fuga’})
s.get_multi([‘foo’, ‘bar’, ‘baz’]) #=> {‘foo’ => ‘hoge’, ‘bar’ => ‘fuga’}


#            2
s.set(“foo”, “${now}”) #=> ${now}
s.get(“foo”) #=> “2010-07-10 14:19:12” #=>                  dump      ?


#            3
set(key, val, second=nil)                 (           )
set(key, val, Time=nil)               (           )
FileStore



(   …)
#
“           :             ”

filter = WordFilter.new(‘Arsenal’)

# detect #=> true/false
filter.detect(“t_wada:         Arsenal vs Chelsea    !”) #=> true;
filter.detect(“t_wada: ManU vs Liverpool                       ”) #=> false;


# censor #=> String
filter.censor(“t_wada:         Arsenal vs Chelsea        !”)
    #=> “t_wada:        <censored> vs Chelsea      !”
WordFilter   ?



(        …)
    NG
WordFilter   ?


                                    …
     (        …)
 <censored>
…
WordFilter   ?


                                      …
    (       …)
        <censored>
…
WordFilter   ?



(   …)
    (          )
WordFilter



(   …)
#1           NG
filter = WordFilter.new(‘Arsenal’, ‘t_wada’)

#2                                    (                      OK)
filter.censor(“t_wada: Arsenal!!”) #=> “t_wada: <XXX>!!”;

#3
filter.censor(“t_wada: t_wada                       ”)
       #=> “t_wada: <censored>                          ”;

#4
         :             <       (OS     OK)>
         :             <       (OS     OK)>

Contenu connexe

Tendances

ドキュメントを作りたくなってしまう魔法のツール「Sphinx」
ドキュメントを作りたくなってしまう魔法のツール「Sphinx」ドキュメントを作りたくなってしまう魔法のツール「Sphinx」
ドキュメントを作りたくなってしまう魔法のツール「Sphinx」
Yoshiki Shibukawa
 

Tendances (20)

ナレッジグラフ/LOD利用技術の入門(後編)
ナレッジグラフ/LOD利用技術の入門(後編)ナレッジグラフ/LOD利用技術の入門(後編)
ナレッジグラフ/LOD利用技術の入門(後編)
 
ヤフー社内でやってるMySQLチューニングセミナー大公開
ヤフー社内でやってるMySQLチューニングセミナー大公開ヤフー社内でやってるMySQLチューニングセミナー大公開
ヤフー社内でやってるMySQLチューニングセミナー大公開
 
異次元のグラフデータベースNeo4j
異次元のグラフデータベースNeo4j異次元のグラフデータベースNeo4j
異次元のグラフデータベースNeo4j
 
OpenAPI 3.0でmicroserviceのAPI定義を試みてハマった話
OpenAPI 3.0でmicroserviceのAPI定義を試みてハマった話OpenAPI 3.0でmicroserviceのAPI定義を試みてハマった話
OpenAPI 3.0でmicroserviceのAPI定義を試みてハマった話
 
MongoDB〜その性質と利用場面〜
MongoDB〜その性質と利用場面〜MongoDB〜その性質と利用場面〜
MongoDB〜その性質と利用場面〜
 
Python 3.9からの新定番zoneinfoを使いこなそう
Python 3.9からの新定番zoneinfoを使いこなそうPython 3.9からの新定番zoneinfoを使いこなそう
Python 3.9からの新定番zoneinfoを使いこなそう
 
Web エンジニアが postgre sql を選ぶ 3 つの理由
Web エンジニアが postgre sql を選ぶ 3 つの理由Web エンジニアが postgre sql を選ぶ 3 つの理由
Web エンジニアが postgre sql を選ぶ 3 つの理由
 
がっつりMongoDB事例紹介
がっつりMongoDB事例紹介がっつりMongoDB事例紹介
がっつりMongoDB事例紹介
 
Ruby での外部コマンドの実行について
Ruby での外部コマンドの実行についてRuby での外部コマンドの実行について
Ruby での外部コマンドの実行について
 
100%Kotlin ORM Ktormを試してみた
100%Kotlin ORM Ktormを試してみた100%Kotlin ORM Ktormを試してみた
100%Kotlin ORM Ktormを試してみた
 
Java ORマッパー選定のポイント #jsug
Java ORマッパー選定のポイント #jsugJava ORマッパー選定のポイント #jsug
Java ORマッパー選定のポイント #jsug
 
Spring Bootの本当の理解ポイント #jjug
Spring Bootの本当の理解ポイント #jjugSpring Bootの本当の理解ポイント #jjug
Spring Bootの本当の理解ポイント #jjug
 
イミュータブルデータモデル(入門編)
イミュータブルデータモデル(入門編)イミュータブルデータモデル(入門編)
イミュータブルデータモデル(入門編)
 
Ormとの付き合い方
Ormとの付き合い方Ormとの付き合い方
Ormとの付き合い方
 
ビッグデータ処理データベースの全体像と使い分け
ビッグデータ処理データベースの全体像と使い分けビッグデータ処理データベースの全体像と使い分け
ビッグデータ処理データベースの全体像と使い分け
 
AWS Lambdaで作るクローラー/スクレイピング
AWS Lambdaで作るクローラー/スクレイピングAWS Lambdaで作るクローラー/スクレイピング
AWS Lambdaで作るクローラー/スクレイピング
 
JVMのGCアルゴリズムとチューニング
JVMのGCアルゴリズムとチューニングJVMのGCアルゴリズムとチューニング
JVMのGCアルゴリズムとチューニング
 
Where狙いのキー、order by狙いのキー
Where狙いのキー、order by狙いのキーWhere狙いのキー、order by狙いのキー
Where狙いのキー、order by狙いのキー
 
データ履歴管理のためのテンポラルデータモデルとReladomoの紹介 #jjug_ccc #ccc_g3
データ履歴管理のためのテンポラルデータモデルとReladomoの紹介 #jjug_ccc #ccc_g3 データ履歴管理のためのテンポラルデータモデルとReladomoの紹介 #jjug_ccc #ccc_g3
データ履歴管理のためのテンポラルデータモデルとReladomoの紹介 #jjug_ccc #ccc_g3
 
ドキュメントを作りたくなってしまう魔法のツール「Sphinx」
ドキュメントを作りたくなってしまう魔法のツール「Sphinx」ドキュメントを作りたくなってしまう魔法のツール「Sphinx」
ドキュメントを作りたくなってしまう魔法のツール「Sphinx」
 

Similaire à TDDBC お題

第二讲 预备-Python基礎
第二讲 预备-Python基礎第二讲 预备-Python基礎
第二讲 预备-Python基礎
anzhong70
 
Five Things you Need to Know About Scaling
Five Things you Need to Know About ScalingFive Things you Need to Know About Scaling
Five Things you Need to Know About Scaling
MongoDB
 
Refactoring to Macros with Clojure
Refactoring to Macros with ClojureRefactoring to Macros with Clojure
Refactoring to Macros with Clojure
Dmitry Buzdin
 

Similaire à TDDBC お題 (20)

Τα Πολύ Βασικά για την Python
Τα Πολύ Βασικά για την PythonΤα Πολύ Βασικά για την Python
Τα Πολύ Βασικά για την Python
 
A Taste of Python - Devdays Toronto 2009
A Taste of Python - Devdays Toronto 2009A Taste of Python - Devdays Toronto 2009
A Taste of Python - Devdays Toronto 2009
 
Perl 6 in Context
Perl 6 in ContextPerl 6 in Context
Perl 6 in Context
 
Programming Lisp Clojure - 2장 : 클로저 둘러보기
Programming Lisp Clojure - 2장 : 클로저 둘러보기Programming Lisp Clojure - 2장 : 클로저 둘러보기
Programming Lisp Clojure - 2장 : 클로저 둘러보기
 
Basics
BasicsBasics
Basics
 
Hidden treasures of Ruby
Hidden treasures of RubyHidden treasures of Ruby
Hidden treasures of Ruby
 
第二讲 Python基礎
第二讲 Python基礎第二讲 Python基礎
第二讲 Python基礎
 
第二讲 预备-Python基礎
第二讲 预备-Python基礎第二讲 预备-Python基礎
第二讲 预备-Python基礎
 
Invertible-syntax 入門
Invertible-syntax 入門Invertible-syntax 入門
Invertible-syntax 入門
 
Five Things you Need to Know About Scaling
Five Things you Need to Know About ScalingFive Things you Need to Know About Scaling
Five Things you Need to Know About Scaling
 
Refactor like a boss
Refactor like a bossRefactor like a boss
Refactor like a boss
 
Class 6: Lists & dictionaries
Class 6: Lists & dictionariesClass 6: Lists & dictionaries
Class 6: Lists & dictionaries
 
Basic NLP with Python and NLTK
Basic NLP with Python and NLTKBasic NLP with Python and NLTK
Basic NLP with Python and NLTK
 
[SI] Ada Lovelace Day 2014 - Tampon Run
[SI] Ada Lovelace Day 2014  - Tampon Run[SI] Ada Lovelace Day 2014  - Tampon Run
[SI] Ada Lovelace Day 2014 - Tampon Run
 
Python Workshop
Python  Workshop Python  Workshop
Python Workshop
 
Procesamiento del lenguaje natural con python
Procesamiento del lenguaje natural con pythonProcesamiento del lenguaje natural con python
Procesamiento del lenguaje natural con python
 
Pre-Bootcamp introduction to Elixir
Pre-Bootcamp introduction to ElixirPre-Bootcamp introduction to Elixir
Pre-Bootcamp introduction to Elixir
 
Music as data
Music as dataMusic as data
Music as data
 
Refactoring to Macros with Clojure
Refactoring to Macros with ClojureRefactoring to Macros with Clojure
Refactoring to Macros with Clojure
 
Самые вкусные баги из игрового кода: как ошибаются наши коллеги-программисты ...
Самые вкусные баги из игрового кода: как ошибаются наши коллеги-программисты ...Самые вкусные баги из игрового кода: как ошибаются наши коллеги-программисты ...
Самые вкусные баги из игрового кода: как ошибаются наши коллеги-программисты ...
 

Plus de Takuto Wada

Plus de Takuto Wada (20)

組織にテストを書く文化を根付かせる戦略と戦術
組織にテストを書く文化を根付かせる戦略と戦術組織にテストを書く文化を根付かせる戦略と戦術
組織にテストを書く文化を根付かせる戦略と戦術
 
OSS活動の活発さと評価の関係について
OSS活動の活発さと評価の関係についてOSS活動の活発さと評価の関係について
OSS活動の活発さと評価の関係について
 
unassert - encourage reliable programming by writing assertions in production
unassert - encourage reliable programming by writing assertions in productionunassert - encourage reliable programming by writing assertions in production
unassert - encourage reliable programming by writing assertions in production
 
OSS についてあれこれ
OSS についてあれこれOSS についてあれこれ
OSS についてあれこれ
 
power-assert, mechanism and philosophy
power-assert, mechanism and philosophypower-assert, mechanism and philosophy
power-assert, mechanism and philosophy
 
アジャイルサムライの次に読む技術書
アジャイルサムライの次に読む技術書アジャイルサムライの次に読む技術書
アジャイルサムライの次に読む技術書
 
Test Yourself - テストを書くと何がどう変わるか
Test Yourself - テストを書くと何がどう変わるかTest Yourself - テストを書くと何がどう変わるか
Test Yourself - テストを書くと何がどう変わるか
 
テスト用ライブラリ power-assert
テスト用ライブラリ power-assertテスト用ライブラリ power-assert
テスト用ライブラリ power-assert
 
Reviewing RESTful Web Apps
Reviewing RESTful Web AppsReviewing RESTful Web Apps
Reviewing RESTful Web Apps
 
power-assert in JavaScript
power-assert in JavaScriptpower-assert in JavaScript
power-assert in JavaScript
 
TDD のこころ @ OSH2014
TDD のこころ @ OSH2014TDD のこころ @ OSH2014
TDD のこころ @ OSH2014
 
テストを書く文化を育てる戦略と戦術
テストを書く文化を育てる戦略と戦術テストを書く文化を育てる戦略と戦術
テストを書く文化を育てる戦略と戦術
 
私にとってのテスト
私にとってのテスト私にとってのテスト
私にとってのテスト
 
SQLアンチパターン - 開発者を待ち受ける25の落とし穴 (拡大版)
SQLアンチパターン - 開発者を待ち受ける25の落とし穴 (拡大版)SQLアンチパターン - 開発者を待ち受ける25の落とし穴 (拡大版)
SQLアンチパターン - 開発者を待ち受ける25の落とし穴 (拡大版)
 
SQLアンチパターン - 開発者を待ち受ける25の落とし穴
SQLアンチパターン - 開発者を待ち受ける25の落とし穴SQLアンチパターン - 開発者を待ち受ける25の落とし穴
SQLアンチパターン - 開発者を待ち受ける25の落とし穴
 
愛せないコードを書くには人生はあまりにも短い
愛せないコードを書くには人生はあまりにも短い愛せないコードを書くには人生はあまりにも短い
愛せないコードを書くには人生はあまりにも短い
 
ペアプログラミング ホントのところ
ペアプログラミング ホントのところペアプログラミング ホントのところ
ペアプログラミング ホントのところ
 
RESTful Web アプリの設計レビューの話
RESTful Web アプリの設計レビューの話RESTful Web アプリの設計レビューの話
RESTful Web アプリの設計レビューの話
 
例外設計における大罪
例外設計における大罪例外設計における大罪
例外設計における大罪
 
DevLOVE DDDBC
DevLOVE DDDBCDevLOVE DDDBC
DevLOVE DDDBC
 

Dernier

Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 

Dernier (20)

Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 

TDDBC お題

  • 1.
  • 2. Write a program that prints the numbers from 1 to 100. But for multiples of three print “Fizz” instead of the number and for the multiples of five print “Buzz”. For numbers which are multiples of both three and five print “FizzBuzz”. 1 100 3 Fizz 5 Buzz 3 5 FizzBuzz http://tickletux.wordpress.com/2007/01/24/using-fizzbuzz-to-find-developers-who-grok-coding/ http://www.aoky.net/articles/jeff_atwood/why_cant_programmers_program.htm
  • 4.
  • 5. Map Last Recently Used (LRU) Cache Map
  • 6. # lru.put(“a”, “dataA”); lru.put(“b”, “dataB”); lru.put(“c”, “dataC”); lru.get(“a”); #=> null # get lru.put(“a”, “dataA”); lru.put(“b”, “dataB”); lru.get(“a”); #=> “dataA” lru.put(“c”, “dataC”); lru.get(“b”); #=> null
  • 7. LRU Cache ? ( …)
  • 8. LRU Cache ? ( …)
  • 9. LRU Cache ( …)
  • 10.
  • 11. s = FileStore.new s.set(“foo”, “hoge”) s.get(“foo”) #=> “hoge” s.dump #=> “foo:hoge¥n” s.set(“bar”, “fuga”) s.dump #=> “foo:hoge¥nbar:fuga¥n” s.get(“toto”) #=> nil s.set(nil, “momo”) # nil s.set(“”, “gogo”) # s.dump #=> “foo:hoge¥nbar:fuga¥n” s.set(“foo”, “piyo”) s.dump #=> “bar:fuga¥nfoo:piyo¥n”
  • 12. FileStore ? ( …) void : set_multi(Map) Map : get_multi(Array) s.set_multi({‘foo’ => ‘hoge’, ‘bar’ => ‘fuga’}) s.get_multi([‘foo’, ‘bar’, ‘baz’]) #=> {‘foo’ => ‘hoge’, ‘bar’ => ‘fuga’}
  • 13. FileStore ? ( …) s.set(“foo”, “${now}”) #=> ${now} s.get(“foo”) #=> “2010-07-10 14:19:12”
  • 14. FileStore ( …) set(key, val, second) ( ) set(key, val, Time) ( )
  • 15. # 1 s.set_multi({‘foo’ => ‘hoge’, ‘bar’ => ‘fuga’}) s.get_multi([‘foo’, ‘bar’, ‘baz’]) #=> {‘foo’ => ‘hoge’, ‘bar’ => ‘fuga’} # 2 s.set(“foo”, “${now}”) #=> ${now} s.get(“foo”) #=> “2010-07-10 14:19:12” #=> dump ? # 3 set(key, val, second=nil) ( ) set(key, val, Time=nil) ( )
  • 16. FileStore ( …)
  • 17.
  • 18.
  • 19.
  • 20. # “ : ” filter = WordFilter.new(‘Arsenal’) # detect #=> true/false filter.detect(“t_wada: Arsenal vs Chelsea !”) #=> true; filter.detect(“t_wada: ManU vs Liverpool ”) #=> false; # censor #=> String filter.censor(“t_wada: Arsenal vs Chelsea !”) #=> “t_wada: <censored> vs Chelsea !”
  • 21. WordFilter ? ( …) NG
  • 22. WordFilter ? … ( …) <censored> …
  • 23. WordFilter ? … ( …) <censored> …
  • 24. WordFilter ? ( …) ( )
  • 25. WordFilter ( …)
  • 26. #1 NG filter = WordFilter.new(‘Arsenal’, ‘t_wada’) #2 ( OK) filter.censor(“t_wada: Arsenal!!”) #=> “t_wada: <XXX>!!”; #3 filter.censor(“t_wada: t_wada ”) #=> “t_wada: <censored> ”; #4 : < (OS OK)> : < (OS OK)>