トップ «前の日記(2009-05-07) 最新 次の日記(2009-05-09)» 編集

ヨタの日々

2001|08|09|10|11|12|
2002|01|02|03|04|05|06|07|08|09|10|11|12|
2003|01|02|03|04|05|06|07|08|09|10|11|12|
2004|01|02|03|04|05|06|07|08|09|10|11|12|
2005|01|02|03|04|05|06|07|08|09|10|11|12|
2006|01|02|03|04|05|06|07|08|09|10|11|12|
2007|01|02|03|04|05|06|07|08|09|10|11|12|
2008|01|02|03|04|05|06|07|08|09|10|11|12|
2009|01|02|03|04|05|06|07|08|09|10|11|12|
2010|01|02|03|04|05|06|07|08|09|10|11|12|
2011|01|02|03|04|05|06|07|08|09|10|11|12|
2012|01|02|03|04|05|06|07|08|09|10|11|12|
2013|01|02|03|04|05|06|07|08|09|10|11|12|
2014|01|02|03|04|05|06|07|08|09|10|11|12|
2015|01|02|03|04|05|06|07|08|09|10|11|12|
2016|01|02|03|04|05|06|07|08|09|10|11|12|
2017|01|02|03|04|05|06|07|08|09|10|11|12|
2018|01|02|03|04|05|06|07|08|09|10|11|12|
2019|01|02|03|04|05|06|07|08|09|10|11|12|
2020|01|02|03|04|05|06|07|08|09|10|11|12|
2021|01|02|03|04|05|06|07|08|09|10|11|12|
2022|01|02|03|04|05|06|07|08|09|10|11|12|
2023|01|02|03|04|05|06|07|08|12|
2024|01|02|03|04|

2009-05-08 :-)

_ 朝ッ

0700 起床

首が痛い

_ 仕事

休み

_ ちょっと休憩

20090508_0.jpg

レアチーズケーキ

_ [デザインパターン][Adapter]Head First デザインパターンを写経する - 7章 Adapter パターン

#!/usr/bin/ruby -Ks

module Duck
  def quack
  end

  def fly
  end
end

class MallardDuck
  include Duck

  def quack
    puts "ガーガー"
  end

  def fly
    puts "飛んでいます"
  end
end

module Turkey
  def gobble
  end

  def fly
  end
end

class WildTurkey
  include Turkey

  def gobble
    puts "ゴロゴロ"
  end

  def fly
    puts "短い距離を飛んでいます"
  end
end

class TurkeyAdapter
  include Duck

  def initialize( turkey )
    @turkey = turkey
  end

  def quack
    @turkey.gobble
  end

  def fly
    5.times do
      @turkey.fly
    end
  end
end

def main
  duck = MallardDuck.new
  turkey = WildTurkey.new
  turkeyAdapter = TurkeyAdapter.new( turkey )

  puts "Turky の出力..."
  turkey.gobble
  turkey.fly

  puts "\nDuck の出力..."
  testDuck( duck )

  puts "\nTurkeyAdapter の出力..."
  testDuck( turkeyAdapter )
end

def testDuck( duck )
  duck.quack
  duck.fly
end

main
% ./duck.rb
Turky の出力...
ゴロゴロ
短い距離を飛んでいます

Duck の出力...
ガーガー
飛んでいます

TurkeyAdapter の出力...
ゴロゴロ
短い距離を飛んでいます
短い距離を飛んでいます
短い距離を飛んでいます
短い距離を飛んでいます
短い距離を飛んでいます

_ [リッジレーサー7]リッジレーサー7

JUJAK 練習。この振り回され具合は挫けそうになる。

  • 走行距離 18823.560 km
  • RSGP 進行度 100.0 %
  • 名声 18455 FP

_ [デザインパターン][Template Method]Head First デザインパターンを写経する - 8章 Template Method パターン

#!/usr/bin/ruby -Ks

class CaffeineBeverage
  def prepareRecipe
    boilWater
    brew
    pourInCup
    addCondiments
  end

  def brew
  end

  def addCondiments
  end

  def boilWater
    puts "お湯を沸かします"
  end

  def pourInCup
    puts "カップに注ぎます"
  end
end

class Tea < CaffeineBeverage
  def brew
    puts "紅茶を浸します"
  end

  def addCondiments
    puts "レモンを追加します"
  end
end

class Coffee < CaffeineBeverage
  def brew
    puts "フィルタでコーヒーをドリップします"
  end

  def addCondiments
    puts "砂糖とミルクを追加します"
  end
end

def main
  tea = Tea.new
  coffee = Coffee.new

  puts "\n紅茶を作っています..."
  tea.prepareRecipe

  puts "\nコーヒーを作っています..."
  coffee.prepareRecipe
end

main
% ./beverage.rb

紅茶を作っています...
お湯を沸かします
紅茶を浸します
カップに注ぎます
レモンを追加します

コーヒーを作っています...
お湯を沸かします
フィルタでコーヒーをドリップします
カップに注ぎます
砂糖とミルクを追加します

_ [おひる][シーフードのクリームソーススパゲティ]おひる

シーフードのクリームソーススパゲティ

_ [豚肉のしょうが焼き][]飯

豚肉のしょうが焼き( ref. きょうの料理 2006-09 p.94 )