Home / 別館 Home / Ruby / デザインパターン / UML からスクリプトへの変換
| 掲示板 | Mail |

UML図から Ruby スクリプトをどこまで書けるか

クラス図

基本

class Foo
  def initialize
    @foo = ""
  end
  
  def add( var )
  end
end

継承

class Animal
  def initialize
  end
end

class Dog << Animal
end

class Cat  << Animal
end

関連

class Foo
  def initialize
    @foo = ""
  end
  
  def add( var )
  end
end

class Hoge
  def initialize
    @hoge = ""
  end
  
  def count( foo )  # foo は Foo のインスタンスを前提とする
  end
end

hoge = Hoge.new
foo = Foo.new
hoge.count( foo )

コンポジット



Home / 別館 Home / Ruby / デザインパターン / UML からスクリプトへの変換
| 掲示板 | Mail |

とみくら まさや(vzx01036@nifty.ne.jp) $ Date: 2003/08/06 $