Skip to content

Latest commit

 

History

History
62 lines (43 loc) · 1.11 KB

tut_uml_modeling_bs08.adoc

File metadata and controls

62 lines (43 loc) · 1.11 KB

モデルからコードを得る

実装に使うクラス図とステートマシン図が作成できたので、これらを参照して実装コードを作成しましょう。

実装に使うプログラミング言語はRubyです。 クラス図やステートマシン図に合わせてRubyのコードを書いていきましょう。

パッケージ構成

モデル図ではBowlingパッケージにクラスを配置しています。 RubyにはModuleがあるので、これをモデル図のパッケージに対応させます。

  • Module

    • Bowling(bowling.rb)

    • GameScore(game_score.rb)

    • Frame(frane.rb)

実装

frame.rb

【Ruby】frame.rb
link:{sourcesdir}/frame.rb[role=include]

game_score.rb

【Ruby】game_score.rb
link:{sourcesdir}/game_score.rb[role=include]

bowling.rb

【Ruby】bowling.rb
link:{sourcesdir}/bowling.rb[role=include]