クラウド
アプリケーション
モデリング
へのアプローチ
浅海智晴
匠Lab
2010年5月12日
文脈
活動の概要
活動対象の技術
SIMPLEMODELING
SimpleModelingの本
モデルの軸
ミッシングリンク
メッセージフロー図
メッセージフローの理由
SIMPLEMODELER
SimpleModeler
                                                                                     Web仕様書


                                    project                                           クラス図
                                                             html
                                                                                      ステート
   CSV      import                                                                   マシーン図


                                                               java
                             SimpleModelリポジトリ
                                (Maven project)                                    Javaプログラム
  convert
                                                              grails
                                      Scala DSL
                                                                                  Grailsプログラム
            import
                                                                      gae
  Mindmap
  (Xmind)
                                                                              Google App Engine/Python
                                                                                     プログラム
                                                                       gaej
                           verify                  testset
            import

                                                                               Google App Engine/Java
                                                              gaeo                   プログラム
   Excel


                           検証結果                   テストセット                        Google App Engine Oil
                                                                                     プログラム
                     企画中
Scala DSL
package com.yorozu

import org.simplemodeling.dsl._
import org.simplemodeling.dsl.datatype._
import org.simplemodeling.dsl.domain._
import org.simplemodeling.dsl.domain.values._

case class DER製品 extends DomainResource {
 term = "製品"
 caption = "製品"
 brief = <t></t>
 description = <text></text>

    id("製品Id", DVI製品Id())
    attribute("製品Name", DVN製品Name())
}

case class DVI製品Id extends DomainValueId {
 term = "製品Id"
 caption = "製品Id"
 brief = <t></t>
 description = <text></text>

    attribute("value", XString)
}

case class DVN製品Name extends DomainValueName {
 term = "製品Name"
 caption = "製品Name"
 brief = <t></t>
 description = <text></text>

    attribute("value", XString)
}
クラス図
Scala DSL→ステートマシーン図
package com.yorozu
                                                 case class DMS入荷待 extends DomainState {
import org.simplemodeling.dsl._                   term = "入荷待"
import org.simplemodeling.dsl.datatype._          caption = "入荷待"
import org.simplemodeling.dsl.domain._            brief = <t></t>
import org.simplemodeling.dsl.domain.values._     description = <text></text>

case class DER商品 extends DomainResource {            transition(DEE商品入荷(), DMS在庫中())
 term = "商品"                                     }
 caption = "商品"
 brief = <t></t>                                 case class DMS在庫中 extends DomainState {
 description = <text></text>                      term = "在庫中"
                                                  caption = "在庫中"
    id("商品Id", DVI商品Id())                         brief = <t></t>
    attribute("商品Name", DVN商品Name())              description = <text></text>
    association("製品", DER製品(), OneMore)
    statemachine(DM商品状態())                           transition(DEE顧客購入(), DMS配送中())
}                                                    transition(DEE顧客購入(), DMS販売完())
                                                 }
・・・中略・・・
case class DM商品状態 extends DomainStateMachine {   case class DMS配送中 extends DomainState {
 term = "商品状態"                                    term = "配送中"
 caption = "商品状態"                                 caption = "配送中"
 brief = <t></t>                                  brief = <t></t>
 description = <text></text>                      description = <text></text>

    state(DMS入荷待())                                  transition(DEE商品配送(), DMS販売完())
    state(DMS在庫中())                              }
    state(DMS配送中())
    state(DMS販売完())                              case class DMS販売完 extends DomainState {
}                                                 term = "販売完"
                                                  caption = "販売完"
                                                  brief = <t></t>
                                                  description = <text></text>

                                                 }
ステートマシーン図と状態遷移表
関連
                              関連の種類
<<aggregate>>
                                   関連(association)
                                   集約 (aggregation)
                                   合成 (composition)
                                   whole-partの合成
                              多重度
                                   1, 0..1(?), 1..N(+), 0..N(*)
                              DataStore Id
                                   Key, String, Long
                              物理ID、論理ID
                              エンティティ参照
                                   物理ID、論理ID
                              自動採番、手動採番
                              物理更新、論理更新
                              物理削除、論理削除
                <<part>>
                              unary、binary
                              リンク参照、Query参照
                              キャッシュ有無
                              トランザクション
                                   気にしない、BASE、ACID
G3フレームワーク
g3 DSL例(1)
                                                     Enterprise
class Join extends G3Application {             Integration Patterns
                                                Splitter/Aggregator
 agent('compute) {
   case x: Int => x + 100
 }

  start(List(1, 2, 3, 4, 5)) split() publish("compute") join()
aggregate()
}
g3 DSL 例(2)                                     RESTサービス
                                                AtomFeed
class TwitterScan extends G3Application {
 service('demogon,
"http://[user]:[password]@twitter.com/statuses/user_timeline/[user].atom")

    start invoke("demogon") agent {
      case AtomFeed(feed) => feed.toString
      case _ => "???"
    } agent {
      x => println("==> " + x)
      x
    }
}
論点
• メタモデルの対応点
  • 静的構造モデル
        • BASE対応
        • DSLによる特性の定義とDSLコンパイラで対応できないか?
  • 振舞いモデル
        • 故障、遅延、規模をどう扱うか
        • メッセージフローモデルで対応できないか?
• DSL
  • 有効性、使いどころ
• プログラミング・モデル
  • 故障、遅延、規模を扱うためのプログラミング・モデル、
    フレームワークはどのようなものか

クラウド・アプリケーション・モデリングへのアプローチ

  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
    SimpleModeler Web仕様書 project クラス図 html ステート CSV import マシーン図 java SimpleModelリポジトリ (Maven project) Javaプログラム convert grails Scala DSL Grailsプログラム import gae Mindmap (Xmind) Google App Engine/Python プログラム gaej verify testset import Google App Engine/Java gaeo プログラム Excel 検証結果 テストセット Google App Engine Oil プログラム 企画中
  • 13.
    Scala DSL package com.yorozu importorg.simplemodeling.dsl._ import org.simplemodeling.dsl.datatype._ import org.simplemodeling.dsl.domain._ import org.simplemodeling.dsl.domain.values._ case class DER製品 extends DomainResource { term = "製品" caption = "製品" brief = <t></t> description = <text></text> id("製品Id", DVI製品Id()) attribute("製品Name", DVN製品Name()) } case class DVI製品Id extends DomainValueId { term = "製品Id" caption = "製品Id" brief = <t></t> description = <text></text> attribute("value", XString) } case class DVN製品Name extends DomainValueName { term = "製品Name" caption = "製品Name" brief = <t></t> description = <text></text> attribute("value", XString) }
  • 14.
  • 15.
    Scala DSL→ステートマシーン図 package com.yorozu case class DMS入荷待 extends DomainState { import org.simplemodeling.dsl._ term = "入荷待" import org.simplemodeling.dsl.datatype._ caption = "入荷待" import org.simplemodeling.dsl.domain._ brief = <t></t> import org.simplemodeling.dsl.domain.values._ description = <text></text> case class DER商品 extends DomainResource { transition(DEE商品入荷(), DMS在庫中()) term = "商品" } caption = "商品" brief = <t></t> case class DMS在庫中 extends DomainState { description = <text></text> term = "在庫中" caption = "在庫中" id("商品Id", DVI商品Id()) brief = <t></t> attribute("商品Name", DVN商品Name()) description = <text></text> association("製品", DER製品(), OneMore) statemachine(DM商品状態()) transition(DEE顧客購入(), DMS配送中()) } transition(DEE顧客購入(), DMS販売完()) } ・・・中略・・・ case class DM商品状態 extends DomainStateMachine { case class DMS配送中 extends DomainState { term = "商品状態" term = "配送中" caption = "商品状態" caption = "配送中" brief = <t></t> brief = <t></t> description = <text></text> description = <text></text> state(DMS入荷待()) transition(DEE商品配送(), DMS販売完()) state(DMS在庫中()) } state(DMS配送中()) state(DMS販売完()) case class DMS販売完 extends DomainState { } term = "販売完" caption = "販売完" brief = <t></t> description = <text></text> }
  • 16.
  • 17.
    関連  関連の種類 <<aggregate>>  関連(association)  集約 (aggregation)  合成 (composition)  whole-partの合成  多重度  1, 0..1(?), 1..N(+), 0..N(*)  DataStore Id  Key, String, Long  物理ID、論理ID  エンティティ参照  物理ID、論理ID  自動採番、手動採番  物理更新、論理更新  物理削除、論理削除 <<part>>  unary、binary  リンク参照、Query参照  キャッシュ有無  トランザクション  気にしない、BASE、ACID
  • 18.
  • 19.
    g3 DSL例(1) Enterprise class Join extends G3Application { Integration Patterns Splitter/Aggregator agent('compute) { case x: Int => x + 100 } start(List(1, 2, 3, 4, 5)) split() publish("compute") join() aggregate() }
  • 20.
    g3 DSL 例(2) RESTサービス AtomFeed class TwitterScan extends G3Application { service('demogon, "http://[user]:[password]@twitter.com/statuses/user_timeline/[user].atom") start invoke("demogon") agent { case AtomFeed(feed) => feed.toString case _ => "???" } agent { x => println("==> " + x) x } }
  • 21.
    論点 • メタモデルの対応点 • 静的構造モデル • BASE対応 • DSLによる特性の定義とDSLコンパイラで対応できないか? • 振舞いモデル • 故障、遅延、規模をどう扱うか • メッセージフローモデルで対応できないか? • DSL • 有効性、使いどころ • プログラミング・モデル • 故障、遅延、規模を扱うためのプログラミング・モデル、 フレームワークはどのようなものか