TDDBC お題

7,218 views

Published on

TDDBC のお題です

TDDBC お題

  1. 1. Write a program that prints the numbers from 1 to 100. But formultiples of three print “Fizz” instead of the number and for themultiples of five print “Buzz”. For numbers which are multiples ofboth three and five print “FizzBuzz”.1 1003 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
  2. 2. http://www.cs.is.saga-u.ac.jp/~nakayama07/sotsuken.html
  3. 3. Map Last Recently Used (LRU) Cache Map
  4. 4. #lru.put(“a”, “dataA”);lru.put(“b”, “dataB”);lru.put(“c”, “dataC”);lru.get(“a”); #=> null# getlru.put(“a”, “dataA”);lru.put(“b”, “dataB”);lru.get(“a”); #=> “dataA”lru.put(“c”, “dataC”);lru.get(“b”); #=> null
  5. 5. LRU Cache ?( …)
  6. 6. LRU Cache ?( …)
  7. 7. LRU Cache( …)
  8. 8. s = FileStore.news.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”) #=> nils.set(nil, “momo”) # nils.set(“”, “gogo”) #s.dump #=> “foo:hoge¥nbar:fuga¥n”s.set(“foo”, “piyo”)s.dump #=> “bar:fuga¥nfoo:piyo¥n”
  9. 9. 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’}
  10. 10. FileStore ? ( …)s.set(“foo”, “${now}”) #=> ${now}s.get(“foo”) #=> “2010-07-10 14:19:12”
  11. 11. FileStore ( …)set(key, val, second) ( )set(key, val, Time) ( )
  12. 12. # 1s.set_multi({‘foo’ => ‘hoge’, ‘bar’ => ‘fuga’})s.get_multi([‘foo’, ‘bar’, ‘baz’]) #=> {‘foo’ => ‘hoge’, ‘bar’ => ‘fuga’}# 2s.set(“foo”, “${now}”) #=> ${now}s.get(“foo”) #=> “2010-07-10 14:19:12” #=> dump ?# 3set(key, val, second=nil) ( )set(key, val, Time=nil) ( )
  13. 13. FileStore( …)
  14. 14. #“ : ”filter = WordFilter.new(‘Arsenal’)# detect #=> true/falsefilter.detect(“t_wada: Arsenal vs Chelsea !”) #=> true;filter.detect(“t_wada: ManU vs Liverpool ”) #=> false;# censor #=> Stringfilter.censor(“t_wada: Arsenal vs Chelsea !”) #=> “t_wada: <censored> vs Chelsea !”
  15. 15. WordFilter ?( …) NG
  16. 16. WordFilter ? … ( …) <censored>…
  17. 17. WordFilter ? … ( …) <censored>…
  18. 18. WordFilter ?( …) ( )
  19. 19. WordFilter( …)
  20. 20. #1 NGfilter = WordFilter.new(‘Arsenal’, ‘t_wada’)#2 ( OK)filter.censor(“t_wada: Arsenal!!”) #=> “t_wada: <XXX>!!”;#3filter.censor(“t_wada: t_wada ”) #=> “t_wada: <censored> ”;#4 : < (OS OK)> : < (OS OK)>

×