Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
DCI and Ruby
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Fabio Kuhn
January 31, 2012
Programming
230
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
DCI and Ruby
What is DCI and how can we use it with Ruby?
Fabio Kuhn
January 31, 2012
More Decks by Fabio Kuhn
See All by Fabio Kuhn
RubyMotion
mordaroso
1
210
Other Decks in Programming
See All in Programming
技術記事、 専門家としてのプログラマ、 言語化
mizchi
13
6.5k
技術的負債解消で開発者の未来を開く- AIの力でコード刷新
kmd2kmd
0
120
脅威をエンジニアリングの糧にして――現場編 / Turning Threats into Engineering Fuel — Field Edition
nrslib
0
300
Make SRE Operations Easier with Azure SRE Agent
kkamegawa
0
8.1k
Inside Stream API
skrb
1
780
不変条件と整合性境界—ビジネスが決める設計判断と実現パターン / Invariants and Consistency Boundaries
nrslib
14
5.8k
IBM Bobを活用したレガシーアプリの最新化
oniak3ibm
PRO
1
220
Contextとはなにか
chiroruxx
1
370
TypeScript+Orvalで実現する型安全かつ堅牢でスケーラブルなマルチチャネル通知基盤 / TSKaigi Night talks ~after conference~
d0riven
0
360
SREは、MCPとSRE Agentをこう使え!
kazumax55
0
110
なぜ型を書くのか? TSKaigi2026で改めて考える #tskaigi_smarthr
kajitack
0
160
JavaDoc 再入門
nagise
1
420
Featured
See All Featured
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
4.3k
Design in an AI World
tapps
1
250
The Director’s Chair: Orchestrating AI for Truly Effective Learning
tmiket
1
200
職位にかかわらず全員がリーダーシップを発揮するチーム作り / Building a team where everyone can demonstrate leadership regardless of position
madoxten
62
55k
Conquering PDFs: document understanding beyond plain text
inesmontani
PRO
4
2.8k
The Straight Up "How To Draw Better" Workshop
denniskardys
239
140k
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.8k
Principles of Awesome APIs and How to Build Them.
keavy
128
18k
Breaking role norms: Why Content Design is so much more than writing copy - Taylor Woolridge
uxyall
0
330
Noah Learner - AI + Me: how we built a GSC Bulk Export data pipeline
techseoconnect
PRO
0
200
GitHub's CSS Performance
jonrohan
1033
470k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
333
23k
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