SlideShare uma empresa Scribd logo
1 de 30
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

Mais conteúdo relacionado

Semelhante a DCI ANUG - 24th November 2010

UNIT IV DESIGN PATTERNS.pptx
UNIT IV DESIGN PATTERNS.pptxUNIT IV DESIGN PATTERNS.pptx
UNIT IV DESIGN PATTERNS.pptxanguraju1
 
Unified Modeling Language
Unified Modeling LanguageUnified Modeling Language
Unified Modeling LanguageGiO Friginal
 
Object-Relational Mapping and Dependency Injection
Object-Relational Mapping and Dependency InjectionObject-Relational Mapping and Dependency Injection
Object-Relational Mapping and Dependency InjectionShane Church
 
Object-Oriented Analysis and Design
Object-Oriented Analysis and DesignObject-Oriented Analysis and Design
Object-Oriented Analysis and DesignRiazAhmad786
 
UML Diagrams- Unified Modeling Language Introduction
UML Diagrams- Unified Modeling Language IntroductionUML Diagrams- Unified Modeling Language Introduction
UML Diagrams- Unified Modeling Language IntroductionRamakant Soni
 
Formally Defining and Iterating Infinite Models (MODELS 2012)
Formally Defining and Iterating Infinite Models (MODELS 2012)Formally Defining and Iterating Infinite Models (MODELS 2012)
Formally Defining and Iterating Infinite Models (MODELS 2012)Benoit Combemale
 
Using the Crowd to Understand and Adapt User Interfaces
Using the Crowd to Understand and Adapt User InterfacesUsing the Crowd to Understand and Adapt User Interfaces
Using the Crowd to Understand and Adapt User InterfacesJeffrey Nichols
 
Object Oriented Database
Object Oriented DatabaseObject Oriented Database
Object Oriented DatabaseMegan Espinoza
 
Applying system thinking to model-based software engineering
Applying system thinking to model-based software engineeringApplying system thinking to model-based software engineering
Applying system thinking to model-based software engineeringProf. Amir Tomer
 
MWLUG 2015 - An Introduction to MVC
MWLUG 2015 - An Introduction to MVCMWLUG 2015 - An Introduction to MVC
MWLUG 2015 - An Introduction to MVCUlrich Krause
 
An Introduction To Model  View  Controller In XPages
An Introduction To Model  View  Controller In XPagesAn Introduction To Model  View  Controller In XPages
An Introduction To Model  View  Controller In XPagesUlrich Krause
 
UML, OWL and REA based enterprise business model 20110201a
UML, OWL and REA based enterprise business model 20110201aUML, OWL and REA based enterprise business model 20110201a
UML, OWL and REA based enterprise business model 20110201aRichard Kuo
 
.net Based Component Technologies
.net Based Component Technologies.net Based Component Technologies
.net Based Component Technologiesprakashk453625
 
Chapter-2 UML and UML Diagrams.pdf
Chapter-2 UML and UML Diagrams.pdfChapter-2 UML and UML Diagrams.pdf
Chapter-2 UML and UML Diagrams.pdfAkfeteAssefa
 
Ml infra at an early stage
Ml infra at an early stageMl infra at an early stage
Ml infra at an early stageNick Handel
 

Semelhante a DCI ANUG - 24th November 2010 (20)

UNIT IV DESIGN PATTERNS.pptx
UNIT IV DESIGN PATTERNS.pptxUNIT IV DESIGN PATTERNS.pptx
UNIT IV DESIGN PATTERNS.pptx
 
Unified Modeling Language
Unified Modeling LanguageUnified Modeling Language
Unified Modeling Language
 
Object-Relational Mapping and Dependency Injection
Object-Relational Mapping and Dependency InjectionObject-Relational Mapping and Dependency Injection
Object-Relational Mapping and Dependency Injection
 
Service as-a-software
Service as-a-softwareService as-a-software
Service as-a-software
 
UML Intro
UML IntroUML Intro
UML Intro
 
Object-Oriented Analysis and Design
Object-Oriented Analysis and DesignObject-Oriented Analysis and Design
Object-Oriented Analysis and Design
 
UML Diagrams- Unified Modeling Language Introduction
UML Diagrams- Unified Modeling Language IntroductionUML Diagrams- Unified Modeling Language Introduction
UML Diagrams- Unified Modeling Language Introduction
 
Formally Defining and Iterating Infinite Models (MODELS 2012)
Formally Defining and Iterating Infinite Models (MODELS 2012)Formally Defining and Iterating Infinite Models (MODELS 2012)
Formally Defining and Iterating Infinite Models (MODELS 2012)
 
OOP-1.pptx
OOP-1.pptxOOP-1.pptx
OOP-1.pptx
 
Using the Crowd to Understand and Adapt User Interfaces
Using the Crowd to Understand and Adapt User InterfacesUsing the Crowd to Understand and Adapt User Interfaces
Using the Crowd to Understand and Adapt User Interfaces
 
Object Oriented Database
Object Oriented DatabaseObject Oriented Database
Object Oriented Database
 
Applying system thinking to model-based software engineering
Applying system thinking to model-based software engineeringApplying system thinking to model-based software engineering
Applying system thinking to model-based software engineering
 
MWLUG 2015 - An Introduction to MVC
MWLUG 2015 - An Introduction to MVCMWLUG 2015 - An Introduction to MVC
MWLUG 2015 - An Introduction to MVC
 
An Introduction To Model  View  Controller In XPages
An Introduction To Model  View  Controller In XPagesAn Introduction To Model  View  Controller In XPages
An Introduction To Model  View  Controller In XPages
 
UML, OWL and REA based enterprise business model 20110201a
UML, OWL and REA based enterprise business model 20110201aUML, OWL and REA based enterprise business model 20110201a
UML, OWL and REA based enterprise business model 20110201a
 
.net Based Component Technologies
.net Based Component Technologies.net Based Component Technologies
.net Based Component Technologies
 
Chapter-2 UML and UML Diagrams.pdf
Chapter-2 UML and UML Diagrams.pdfChapter-2 UML and UML Diagrams.pdf
Chapter-2 UML and UML Diagrams.pdf
 
Unit 5
Unit 5Unit 5
Unit 5
 
Ml infra at an early stage
Ml infra at an early stageMl infra at an early stage
Ml infra at an early stage
 
OOSD_UNIT1 (1).pptx
OOSD_UNIT1 (1).pptxOOSD_UNIT1 (1).pptx
OOSD_UNIT1 (1).pptx
 

Mais de Christian Horsdal

Testing microservices.ANUG.20230111.pptx
Testing microservices.ANUG.20230111.pptxTesting microservices.ANUG.20230111.pptx
Testing microservices.ANUG.20230111.pptxChristian Horsdal
 
Scoping microservices.20190917
Scoping microservices.20190917Scoping microservices.20190917
Scoping microservices.20190917Christian Horsdal
 
Event sourcing anug 20190227
Event sourcing anug 20190227Event sourcing anug 20190227
Event sourcing anug 20190227Christian Horsdal
 
Consolidating services with middleware - NDC London 2017
Consolidating services with middleware - NDC London 2017Consolidating services with middleware - NDC London 2017
Consolidating services with middleware - NDC London 2017Christian Horsdal
 
Middleware webnextconf - 20152609
Middleware   webnextconf - 20152609Middleware   webnextconf - 20152609
Middleware webnextconf - 20152609Christian Horsdal
 
Lightweight Approach to Building Web APIs with .NET
Lightweight Approach to Building Web APIs with .NETLightweight Approach to Building Web APIs with .NET
Lightweight Approach to Building Web APIs with .NETChristian Horsdal
 
Three Other Web Frameworks. All .NET. All OSS. One Hour. Go
Three Other Web Frameworks. All .NET. All OSS. One Hour. GoThree Other Web Frameworks. All .NET. All OSS. One Hour. Go
Three Other Web Frameworks. All .NET. All OSS. One Hour. GoChristian Horsdal
 
Four .NET Web Frameworks in Less Than an Hour
Four .NET Web Frameworks in Less Than an HourFour .NET Web Frameworks in Less Than an Hour
Four .NET Web Frameworks in Less Than an HourChristian Horsdal
 
Nancy - A Lightweight .NET Web Framework
Nancy - A Lightweight .NET Web FrameworkNancy - A Lightweight .NET Web Framework
Nancy - A Lightweight .NET Web FrameworkChristian Horsdal
 
DCI - ANUG 24th November 2010
DCI - ANUG 24th November 2010DCI - ANUG 24th November 2010
DCI - ANUG 24th November 2010Christian Horsdal
 

Mais de Christian Horsdal (14)

Testing microservices.ANUG.20230111.pptx
Testing microservices.ANUG.20230111.pptxTesting microservices.ANUG.20230111.pptx
Testing microservices.ANUG.20230111.pptx
 
Scoping microservices.20190917
Scoping microservices.20190917Scoping microservices.20190917
Scoping microservices.20190917
 
Event sourcing anug 20190227
Event sourcing anug 20190227Event sourcing anug 20190227
Event sourcing anug 20190227
 
Consolidating services with middleware - NDC London 2017
Consolidating services with middleware - NDC London 2017Consolidating services with middleware - NDC London 2017
Consolidating services with middleware - NDC London 2017
 
Intro to.net core 20170111
Intro to.net core   20170111Intro to.net core   20170111
Intro to.net core 20170111
 
Middleware webnextconf - 20152609
Middleware   webnextconf - 20152609Middleware   webnextconf - 20152609
Middleware webnextconf - 20152609
 
Campus days 2014 owin
Campus days 2014 owinCampus days 2014 owin
Campus days 2014 owin
 
ASP.NET vNext ANUG 20140817
ASP.NET vNext ANUG 20140817ASP.NET vNext ANUG 20140817
ASP.NET vNext ANUG 20140817
 
Lightweight Approach to Building Web APIs with .NET
Lightweight Approach to Building Web APIs with .NETLightweight Approach to Building Web APIs with .NET
Lightweight Approach to Building Web APIs with .NET
 
Three Other Web Frameworks. All .NET. All OSS. One Hour. Go
Three Other Web Frameworks. All .NET. All OSS. One Hour. GoThree Other Web Frameworks. All .NET. All OSS. One Hour. Go
Three Other Web Frameworks. All .NET. All OSS. One Hour. Go
 
Four .NET Web Frameworks in Less Than an Hour
Four .NET Web Frameworks in Less Than an HourFour .NET Web Frameworks in Less Than an Hour
Four .NET Web Frameworks in Less Than an Hour
 
Nancy + rest mow2012
Nancy + rest   mow2012Nancy + rest   mow2012
Nancy + rest mow2012
 
Nancy - A Lightweight .NET Web Framework
Nancy - A Lightweight .NET Web FrameworkNancy - A Lightweight .NET Web Framework
Nancy - A Lightweight .NET Web Framework
 
DCI - ANUG 24th November 2010
DCI - ANUG 24th November 2010DCI - ANUG 24th November 2010
DCI - ANUG 24th November 2010
 

Último

The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 

Último (20)

The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 

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