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

DCI and Ruby

Avatar for Fabio Kuhn Fabio Kuhn
January 31, 2012

DCI and Ruby

What is DCI and how can we use it with Ruby?

Avatar for Fabio Kuhn

Fabio Kuhn

January 31, 2012
Tweet

More Decks by Fabio Kuhn

Other Decks in Programming

Transcript

  1. What is DCI? Trygve Reenskaug (MVC, UML) Data, context and

    interaction OOP paradigm Goals Improve readability Separation of code System state instead of object state End user style of thinking
  2. Data “What the system is” - Actor Simple object Basic

    functionality / no interaction with other objects Object thinking instead of class thinking
  3. Context “How the system looks and starts” - Director Represents

    one or more use cases Identify objects and assign them roles at runtime Use case functionality = data objects with assigned roles combined
  4. Interaction “What the system does” - Role Roles played by

    objects Stateless call methods on self (= playing object) Interactions are generic
  5. Example Waitress Complex Model (my waitress, employee, person in restaurant)

    Placing an order CustomerOrdersMeal Object Actors: Customer, Waitress Extend Customer with Consumer and Waitress with MenuCard and OrderManager Call waitress.order_meal(customer, meal)
  6. DCI in Rails Data => ActiveRecord Model Context => Controller

    action or separate workflow class Roles => Module to mix in