$30 off During Our Annual Pro Sale. View Details »
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
DCI and Ruby
Search
Fabio Kuhn
January 31, 2012
Programming
1
220
DCI and Ruby
What is DCI and how can we use it with Ruby?
Fabio Kuhn
January 31, 2012
Tweet
Share
More Decks by Fabio Kuhn
See All by Fabio Kuhn
RubyMotion
mordaroso
1
200
Other Decks in Programming
See All in Programming
「コードは上から下へ読むのが一番」と思った時に、思い出してほしい話
panda728
PRO
37
24k
ソフトウェア設計の課題・原則・実践技法
masuda220
PRO
26
22k
20 years of Symfony, what's next?
fabpot
2
330
CSC305 Lecture 17
javiergs
PRO
0
320
TypeScriptで設計する 堅牢さとUXを両立した非同期ワークフローの実現
moeka__c
6
3k
AIコーディングエージェント(Manus)
kondai24
0
150
AIコードレビューがチームの"文脈"を 読めるようになるまで
marutaku
0
340
手軽に積ん読を増やすには?/読みたい本と付き合うには?
o0h
PRO
1
160
バックエンドエンジニアによる Amebaブログ K8s 基盤への CronJobの導入・運用経験
sunabig
0
140
tsgolintはいかにしてtypescript-goの非公開APIを呼び出しているのか
syumai
6
2k
開発に寄りそう自動テストの実現
goyoki
1
730
Developing static sites with Ruby
okuramasafumi
0
200
Featured
See All Featured
Optimising Largest Contentful Paint
csswizardry
37
3.5k
Context Engineering - Making Every Token Count
addyosmani
9
490
Bash Introduction
62gerente
615
210k
The Invisible Side of Design
smashingmag
302
51k
RailsConf 2023
tenderlove
30
1.3k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
231
54k
Mobile First: as difficult as doing things right
swwweet
225
10k
GitHub's CSS Performance
jonrohan
1032
470k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
234
17k
A Modern Web Designer's Workflow
chriscoyier
698
190k
YesSQL, Process and Tooling at Scale
rocio
174
15k
Embracing the Ebb and Flow
colly
88
4.9k
Transcript
DCI and Ruby
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
None
Theatre Director Actors Scene Roles
Data “What the system is” - Actor Simple object Basic
functionality / no interaction with other objects Object thinking instead of class thinking
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
Interaction “What the system does” - Role Roles played by
objects Stateless call methods on self (= playing object) Interactions are generic
None
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)
Conflict or Complementary? Fat Model? MVC / Model2? REST? Ruby?
Rails?
DCI in Rails Data => ActiveRecord Model Context => Controller
action or separate workflow class Roles => Module to mix in
Sources http://en.wikipedia.org/wiki/Data,_Context,_and_Interaction http://andrzejonsoftware.blogspot.com http://nicksda.apotomo.de/2011/12/ruby-on-rest-2- representers-and-the-dci-pattern/ http://mikepackdev.com/blog_posts/24-the-right-way-to- code-dci-in-ruby
Learn more... http://www.leansoftwarearchitecture.com/ http://vimeo.com/8235394