SlideShare a Scribd company logo
DCI Paradigm
ANUG, 24. november 2010
Agenda
• Intro to the DCI paradigm
• Real OO
• Real separation of concerns
• Readable business logic
• Testable
• Break
• Demo
Who Am I?
• Comp. Sci. master from University of Aarhus 2001
• Developer and Architect at Mjølner Informatics
• Blog: horsdal.blogspot.com
4
Domain models at a glance
Wikipedia:
a conceptual model of a
system which describes the
various entities involved in
that system and their
relationships
“Basic domain concepts change
slowly; it’s the features and
technology that change
rapidly”
-James O. Coplien
“a conceptual model of a system
which describes the various
entities involved in that system
and their relationships”
-Wikipedia
Domain Model at a Glance
• About vocabulary
• UL
• About objects first
• Classes a distant second
• The very core of OO architectures
• Captures the essence
L © 2009
5
6
MVC at a glance
Problem
Develop UI that:
• Supports change w/o affecting core
functionality
• Displays current state and responds to
state changes immediately
Solution
Divide into three loosely coupled parts:
• Model objects encapsulate a core entities
• Views present data and information to the
user.
• Controllers are associated with views and
allow manipulation of the presented data
and information.
11
L © 2009
7
Direct manipulation metaphor
MVC at a glance
….again
L © 2009
8
Originally about the end user
MVC at a glance
….again
L © 2009
9
Great for simple apps
But where is the behavior?
L © 2009
10
Moving Into Use Case Territory
• Varied behavior
• Complex behavior
• Domain knowledge mandated
L © 2009
11
L © 2009
12
Moving Into Use Case Territory
Where are the Objects Here?
L © 2009
13
Which accounts?
Classes?
Roles!
Objects
Where is the use case implemented?
L © 2009
14
Where is the use case implemented?
L © 2009
15
___
___
___ ___
___
___
L © 2009
16
The conflict
“Basic domain concepts change
slowly; it’s the features and
technology that change
rapidly”
-James O. Coplien
“[…] algorithms are, or should be,
first class citizens in most
programs”
-James O. Coplien
Traditional OO spreads
algorithms across objects
Features are often in service
objects…these tend to break the
connection between domain
model and UI
“Is” vs “Does”
17
Domain model
Database schema
Architecture
Stable
End user interaction
User experiences
Design
Ever changing
L © 2009
18
DCI: Roles
• In the implementation of use cases
• Objects are manipulated
• Objects play roles
• Objects can take on several roles during runtime
• Roles can be played by several types of objects
• Actions are associated with roles
• Where are actions associated with roles implemented?
19
DCI: Interaction
• Involves several domain objects selected dynamically
• …based on context
• Implemented in the roles
SavingAccount as MoneySource CheckinngAccount as MoneySink TransactionManager
20
DCI: Context
• Encapsulates runtime object graph
• Assign roles to objects
• not to classes
MoneyTransferContex
MoneySource MoneySink TransactionManager
21
DCI: Data
• Concrete domain objects
• Dumb or barely smart
SavingAccount
Balance
Account number
Owner
CheckingAccount
Balance
Account number
Owner
L © 2009
22
DCI and MVC in Concert
L © 2009
23
The conflict - Solved
“Basic domain concepts change
slowly; it’s the features and
technology that change
rapidly”
-James O. Coplien
“[…] algorithms are, or should be,
first class citizens in most
programs”
-James O. Coplien
Roles separate features from
core domain concepts
Context or roles contain the
algorithms directly
Where are actions associated with roles implemented?
L © 2009
24
L © 2009
25
Traits at a glance
Traits are a simple composition mechanism for structuring
object-oriented programs. A Trait is essentially a
parameterized set of methods; it serves as a behavioral
building block for classes and is the primitive unit of code
reuse. With Traits, classes are still organized in a single
inheritance hierarchy, but they can make use of Traits to
specify the incremental difference in behavior with respect
to their superclasses.
-http://scg.unibe.ch/research/traits
L © 2009
26
SavingsAccount CheckingAccount
<<Abstract>>
Account
<<interface>>
MoneySource
<<interface>>
MoneySink
<<trait>>
TransferMoneySource
TransferMoneyContext
Methodless roles
Model
Methodfull roles
Context
Where are actions associated with roles implemented?
• In traits!
• Composition of domain objects and role traits
• Hard in many languages
• But geeky tricks follow
L © 2009
27
Background - DCI
• Invented by Trygve Reenskaug
• Who also invented MVC
• James O. Coplien recently published a book about DCI, agile
and lean
• Nice implementation in Scala, Ruby and Smalltalk
• Acceptable implementations in Python, C++, C# and others
Acknowlegdements
• Direct manipulation metaphor and DCI overview drawings:
Trygve Reenskaug in the common sense article
• Is vs. Does, MVC+DCI figure and quotes: James O. Copliens
book
References
• The book:
http://www.amazon.co.uk/Lean-Architecture-Agile-Software-
Development/dp/0470684208/ref=sr_1_1?ie=UTF8&s=books&qid=128
2367651&sr=8-1
• Introductory article: http://www.artima.com/articles/dci_vision.html
• Data, Context, and Interaction, an architectural pattern in computer
software development http://en.wikipedia.org/wiki/DCI
• DCI home:
http://heim.ifi.uio.no/~trygver/themes/babyide/babyide-index.html
• My C# DCI sample: http://horsdal.blogspot.com/2009/05/dci-in-c.html
• Google group:
http://groups.google.com/group/object-composition?hl=en

More Related Content

PDF
The Evolution of Everything (EvE) and Genetic Programming
billwzel
 
PPT
簡報2
Po Chi Chan
 
PPTX
Facebook Page Checklist - simple
Leona Martin
 
PPTX
Lightweight Approach to Building Web APIs with .NET
Christian Horsdal
 
PDF
Búsqueda de información por Google
Angela Montañez Gomez
 
PPTX
Virtual Assistants - Who, Why, What we can do for YOUR business
Leona Martin
 
PPTX
Nancy + rest mow2012
Christian Horsdal
 
PPTX
Four .NET Web Frameworks in Less Than an Hour
Christian Horsdal
 
The Evolution of Everything (EvE) and Genetic Programming
billwzel
 
簡報2
Po Chi Chan
 
Facebook Page Checklist - simple
Leona Martin
 
Lightweight Approach to Building Web APIs with .NET
Christian Horsdal
 
Búsqueda de información por Google
Angela Montañez Gomez
 
Virtual Assistants - Who, Why, What we can do for YOUR business
Leona Martin
 
Nancy + rest mow2012
Christian Horsdal
 
Four .NET Web Frameworks in Less Than an Hour
Christian Horsdal
 

Similar to DCI - ANUG 24th November 2010 (20)

PPTX
Marco Mancuso - Data Context Interaction
cosenzaLab
 
PPTX
UNIT IV DESIGN PATTERNS.pptx
anguraju1
 
PPTX
Unified Modeling Language
GiO Friginal
 
PPTX
Object-Relational Mapping and Dependency Injection
Shane Church
 
PDF
Service as-a-software
Jean-Jacques Dubray
 
PDF
UML Intro
koppenolski
 
PPT
Object-Oriented Analysis and Design
RiazAhmad786
 
PDF
UML Diagrams- Unified Modeling Language Introduction
Ramakant Soni
 
PDF
Formally Defining and Iterating Infinite Models (MODELS 2012)
Benoit Combemale
 
PPTX
OOP-1.pptx
iansebuabeh
 
PPTX
design pattern is the computer scicence subject
vamsikrishna76598838
 
PPTX
Using the Crowd to Understand and Adapt User Interfaces
Jeffrey Nichols
 
PDF
Object Oriented Database
Megan Espinoza
 
PPTX
Applying system thinking to model-based software engineering
Prof. Amir Tomer
 
PPTX
MWLUG 2015 - An Introduction to MVC
Ulrich Krause
 
PPTX
An Introduction To Model  View  Controller In XPages
Ulrich Krause
 
PDF
UML, OWL and REA based enterprise business model 20110201a
Richard Kuo
 
PPTX
.net Based Component Technologies
prakashk453625
 
PDF
6_Object-oriented-using-java.pdf object oriented programming concepts
harinipradeep15
 
PDF
Chapter-2 UML and UML Diagrams.pdf
AkfeteAssefa
 
Marco Mancuso - Data Context Interaction
cosenzaLab
 
UNIT IV DESIGN PATTERNS.pptx
anguraju1
 
Unified Modeling Language
GiO Friginal
 
Object-Relational Mapping and Dependency Injection
Shane Church
 
Service as-a-software
Jean-Jacques Dubray
 
UML Intro
koppenolski
 
Object-Oriented Analysis and Design
RiazAhmad786
 
UML Diagrams- Unified Modeling Language Introduction
Ramakant Soni
 
Formally Defining and Iterating Infinite Models (MODELS 2012)
Benoit Combemale
 
OOP-1.pptx
iansebuabeh
 
design pattern is the computer scicence subject
vamsikrishna76598838
 
Using the Crowd to Understand and Adapt User Interfaces
Jeffrey Nichols
 
Object Oriented Database
Megan Espinoza
 
Applying system thinking to model-based software engineering
Prof. Amir Tomer
 
MWLUG 2015 - An Introduction to MVC
Ulrich Krause
 
An Introduction To Model  View  Controller In XPages
Ulrich Krause
 
UML, OWL and REA based enterprise business model 20110201a
Richard Kuo
 
.net Based Component Technologies
prakashk453625
 
6_Object-oriented-using-java.pdf object oriented programming concepts
harinipradeep15
 
Chapter-2 UML and UML Diagrams.pdf
AkfeteAssefa
 
Ad

More from Christian Horsdal (11)

PPTX
Testing microservices.ANUG.20230111.pptx
Christian Horsdal
 
PDF
Scoping microservices.20190917
Christian Horsdal
 
PPTX
Event sourcing anug 20190227
Christian Horsdal
 
PPTX
Consolidating services with middleware - NDC London 2017
Christian Horsdal
 
PPTX
Intro to.net core 20170111
Christian Horsdal
 
PPTX
Middleware webnextconf - 20152609
Christian Horsdal
 
PPTX
Campus days 2014 owin
Christian Horsdal
 
PPTX
ASP.NET vNext ANUG 20140817
Christian Horsdal
 
PPTX
Three Other Web Frameworks. All .NET. All OSS. One Hour. Go
Christian Horsdal
 
PPTX
Nancy - A Lightweight .NET Web Framework
Christian Horsdal
 
PPTX
DCI ANUG - 24th November 2010
Christian Horsdal
 
Testing microservices.ANUG.20230111.pptx
Christian Horsdal
 
Scoping microservices.20190917
Christian Horsdal
 
Event sourcing anug 20190227
Christian Horsdal
 
Consolidating services with middleware - NDC London 2017
Christian Horsdal
 
Intro to.net core 20170111
Christian Horsdal
 
Middleware webnextconf - 20152609
Christian Horsdal
 
Campus days 2014 owin
Christian Horsdal
 
ASP.NET vNext ANUG 20140817
Christian Horsdal
 
Three Other Web Frameworks. All .NET. All OSS. One Hour. Go
Christian Horsdal
 
Nancy - A Lightweight .NET Web Framework
Christian Horsdal
 
DCI ANUG - 24th November 2010
Christian Horsdal
 
Ad

Recently uploaded (20)

PDF
The Evolution of KM Roles (Presented at Knowledge Summit Dublin 2025)
Enterprise Knowledge
 
PDF
Event Presentation Google Cloud Next Extended 2025
minhtrietgect
 
PDF
Get More from Fiori Automation - What’s New, What Works, and What’s Next.pdf
Precisely
 
PDF
Brief History of Internet - Early Days of Internet
sutharharshit158
 
PPTX
AI in Daily Life: How Artificial Intelligence Helps Us Every Day
vanshrpatil7
 
PDF
Doc9.....................................
SofiaCollazos
 
PDF
SparkLabs Primer on Artificial Intelligence 2025
SparkLabs Group
 
PDF
Using Anchore and DefectDojo to Stand Up Your DevSecOps Function
Anchore
 
PPTX
Applied-Statistics-Mastering-Data-Driven-Decisions.pptx
parmaryashparmaryash
 
PPTX
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
PDF
How Open Source Changed My Career by abdelrahman ismail
a0m0rajab1
 
PPTX
The-Ethical-Hackers-Imperative-Safeguarding-the-Digital-Frontier.pptx
sujalchauhan1305
 
PPTX
IT Runs Better with ThousandEyes AI-driven Assurance
ThousandEyes
 
PDF
Unlocking the Future- AI Agents Meet Oracle Database 23ai - AIOUG Yatra 2025.pdf
Sandesh Rao
 
PDF
The Future of Artificial Intelligence (AI)
Mukul
 
PPTX
What-is-the-World-Wide-Web -- Introduction
tonifi9488
 
PDF
AI-Cloud-Business-Management-Platforms-The-Key-to-Efficiency-Growth.pdf
Artjoker Software Development Company
 
PPTX
Dev Dives: Automate, test, and deploy in one place—with Unified Developer Exp...
AndreeaTom
 
PDF
CIFDAQ's Market Wrap : Bears Back in Control?
CIFDAQ
 
PDF
The Future of Mobile Is Context-Aware—Are You Ready?
iProgrammer Solutions Private Limited
 
The Evolution of KM Roles (Presented at Knowledge Summit Dublin 2025)
Enterprise Knowledge
 
Event Presentation Google Cloud Next Extended 2025
minhtrietgect
 
Get More from Fiori Automation - What’s New, What Works, and What’s Next.pdf
Precisely
 
Brief History of Internet - Early Days of Internet
sutharharshit158
 
AI in Daily Life: How Artificial Intelligence Helps Us Every Day
vanshrpatil7
 
Doc9.....................................
SofiaCollazos
 
SparkLabs Primer on Artificial Intelligence 2025
SparkLabs Group
 
Using Anchore and DefectDojo to Stand Up Your DevSecOps Function
Anchore
 
Applied-Statistics-Mastering-Data-Driven-Decisions.pptx
parmaryashparmaryash
 
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
How Open Source Changed My Career by abdelrahman ismail
a0m0rajab1
 
The-Ethical-Hackers-Imperative-Safeguarding-the-Digital-Frontier.pptx
sujalchauhan1305
 
IT Runs Better with ThousandEyes AI-driven Assurance
ThousandEyes
 
Unlocking the Future- AI Agents Meet Oracle Database 23ai - AIOUG Yatra 2025.pdf
Sandesh Rao
 
The Future of Artificial Intelligence (AI)
Mukul
 
What-is-the-World-Wide-Web -- Introduction
tonifi9488
 
AI-Cloud-Business-Management-Platforms-The-Key-to-Efficiency-Growth.pdf
Artjoker Software Development Company
 
Dev Dives: Automate, test, and deploy in one place—with Unified Developer Exp...
AndreeaTom
 
CIFDAQ's Market Wrap : Bears Back in Control?
CIFDAQ
 
The Future of Mobile Is Context-Aware—Are You Ready?
iProgrammer Solutions Private Limited
 

DCI - ANUG 24th November 2010

  • 1. DCI Paradigm ANUG, 24. november 2010
  • 2. Agenda • Intro to the DCI paradigm • Real OO • Real separation of concerns • Readable business logic • Testable • Break • Demo
  • 3. Who Am I? • Comp. Sci. master from University of Aarhus 2001 • Developer and Architect at Mjølner Informatics • Blog: horsdal.blogspot.com
  • 4. 4 Domain models at a glance Wikipedia: a conceptual model of a system which describes the various entities involved in that system and their relationships “Basic domain concepts change slowly; it’s the features and technology that change rapidly” -James O. Coplien “a conceptual model of a system which describes the various entities involved in that system and their relationships” -Wikipedia
  • 5. Domain Model at a Glance • About vocabulary • UL • About objects first • Classes a distant second • The very core of OO architectures • Captures the essence L © 2009 5
  • 6. 6 MVC at a glance Problem Develop UI that: • Supports change w/o affecting core functionality • Displays current state and responds to state changes immediately Solution Divide into three loosely coupled parts: • Model objects encapsulate a core entities • Views present data and information to the user. • Controllers are associated with views and allow manipulation of the presented data and information. 11
  • 7. L © 2009 7 Direct manipulation metaphor
  • 8. MVC at a glance ….again L © 2009 8 Originally about the end user
  • 9. MVC at a glance ….again L © 2009 9 Great for simple apps
  • 10. But where is the behavior? L © 2009 10
  • 11. Moving Into Use Case Territory • Varied behavior • Complex behavior • Domain knowledge mandated L © 2009 11
  • 12. L © 2009 12 Moving Into Use Case Territory
  • 13. Where are the Objects Here? L © 2009 13 Which accounts? Classes? Roles! Objects
  • 14. Where is the use case implemented? L © 2009 14
  • 15. Where is the use case implemented? L © 2009 15 ___ ___ ___ ___ ___ ___
  • 16. L © 2009 16 The conflict “Basic domain concepts change slowly; it’s the features and technology that change rapidly” -James O. Coplien “[…] algorithms are, or should be, first class citizens in most programs” -James O. Coplien Traditional OO spreads algorithms across objects Features are often in service objects…these tend to break the connection between domain model and UI
  • 17. “Is” vs “Does” 17 Domain model Database schema Architecture Stable End user interaction User experiences Design Ever changing
  • 18. L © 2009 18 DCI: Roles • In the implementation of use cases • Objects are manipulated • Objects play roles • Objects can take on several roles during runtime • Roles can be played by several types of objects • Actions are associated with roles • Where are actions associated with roles implemented?
  • 19. 19 DCI: Interaction • Involves several domain objects selected dynamically • …based on context • Implemented in the roles SavingAccount as MoneySource CheckinngAccount as MoneySink TransactionManager
  • 20. 20 DCI: Context • Encapsulates runtime object graph • Assign roles to objects • not to classes MoneyTransferContex MoneySource MoneySink TransactionManager
  • 21. 21 DCI: Data • Concrete domain objects • Dumb or barely smart SavingAccount Balance Account number Owner CheckingAccount Balance Account number Owner
  • 22. L © 2009 22 DCI and MVC in Concert
  • 23. L © 2009 23 The conflict - Solved “Basic domain concepts change slowly; it’s the features and technology that change rapidly” -James O. Coplien “[…] algorithms are, or should be, first class citizens in most programs” -James O. Coplien Roles separate features from core domain concepts Context or roles contain the algorithms directly
  • 24. Where are actions associated with roles implemented? L © 2009 24
  • 25. L © 2009 25 Traits at a glance Traits are a simple composition mechanism for structuring object-oriented programs. A Trait is essentially a parameterized set of methods; it serves as a behavioral building block for classes and is the primitive unit of code reuse. With Traits, classes are still organized in a single inheritance hierarchy, but they can make use of Traits to specify the incremental difference in behavior with respect to their superclasses. -http://scg.unibe.ch/research/traits
  • 26. L © 2009 26 SavingsAccount CheckingAccount <<Abstract>> Account <<interface>> MoneySource <<interface>> MoneySink <<trait>> TransferMoneySource TransferMoneyContext Methodless roles Model Methodfull roles Context
  • 27. Where are actions associated with roles implemented? • In traits! • Composition of domain objects and role traits • Hard in many languages • But geeky tricks follow L © 2009 27
  • 28. Background - DCI • Invented by Trygve Reenskaug • Who also invented MVC • James O. Coplien recently published a book about DCI, agile and lean • Nice implementation in Scala, Ruby and Smalltalk • Acceptable implementations in Python, C++, C# and others
  • 29. Acknowlegdements • Direct manipulation metaphor and DCI overview drawings: Trygve Reenskaug in the common sense article • Is vs. Does, MVC+DCI figure and quotes: James O. Copliens book
  • 30. References • The book: http://www.amazon.co.uk/Lean-Architecture-Agile-Software- Development/dp/0470684208/ref=sr_1_1?ie=UTF8&s=books&qid=128 2367651&sr=8-1 • Introductory article: http://www.artima.com/articles/dci_vision.html • Data, Context, and Interaction, an architectural pattern in computer software development http://en.wikipedia.org/wiki/DCI • DCI home: http://heim.ifi.uio.no/~trygver/themes/babyide/babyide-index.html • My C# DCI sample: http://horsdal.blogspot.com/2009/05/dci-in-c.html • Google group: http://groups.google.com/group/object-composition?hl=en