Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Draw with Rails

ogom
September 02, 2014

Draw with Rails

Domain-specific language with Domain-Driven Design

ogom

September 02, 2014
Tweet

More Decks by ogom

Other Decks in Programming

Transcript

  1. Modeling and Coding and Drawing Modeling for designers, Coding for

    programmers. Domain-specific language with Domain-driven design. 2/9
  2. Modeling and Coding Entity-Relationship DSL class Group < ActiveRecord::Base has_many

    :users, through: :members has_many :members, dependent: :destroy end class User < ActiveRecord::Base has_many :groups, through: :members has_many :members, dependent: :destroy end class Member < ActiveRecord::Base belongs_to :group belongs_to :user end 3/9
  3. Modeling and Coding State Machine DSL state_machine initial: :active do

    event :disable do transition active: :inactive end event :enable do transition inactive: :active end event :close do transition [:active, :inactive] => :closed end end 5/9
  4. Modeling and Coding State Machine DSL PlantUML [*] --> active

    active -right-> inactive : disable inactive -left-> active : enable inactive --> closed : close active --> closed : close closed --> [*] 7/9