SlideShare a Scribd company logo
1 of 13
Download to read offline
Data Context Interaction
     What is it good for?


       Markus Nordin
        @mnordin
Disclaimer
I will for the next 30 minutes talk
         smack about MVC

      But i secretly <3 MVC
History of DCI


Trygve Reenskaugs ideas about role based modeling in early
 2000 (same guy who invented MVC in the late seventies)

              Working design model in 2006

             Working prototype in mid 2008

                  Complement to MVC
Why DCI?

          MVC fails to capture behaviour

 There's no apparent place to put interactions
 (exception: simple actions that involves a single object)

          Model should represent things
            Things should be stable

Natural difference between what an object is and
      what it does. Why not in the code?
Goals with DCI

   Giving system behaviour first class status

  Cleanly separate code for rapidly changing
behavior from code for slowly changing domain
                 knowledge

Object style of thinking that is close to peoples
    mental models rather than class style
Data

                What the system is

         Closely corresponds to the Model

Reflects the domain structure rather than behaviour
Context
 Context is a class (instance) which enacts one (or
                   more) use cases

      Instantiated by a user (controller) action

      Mixes in participating objects with Roles

The context is responsible for acting out the use case
Interaction

             What the system does

           Methods in role modules

Implemented by mixing in objects with Roles in a
          given Context or use case
Executing DCI

Controller action starts a use case by instansiating a context
                             class


     The context finds (or creates) the objects that are
               participating in the use case

 The context mixes in all the roles needed into the objects


 The context invokes the role methods on the objects and
              starts the use case enactment
Money transfer example
Bank - send money to another account



             SendMoneyContext



   account                      account


SourceAccount             DestinationAccount
 send(amount)                verify(amount)
                            deposit(amount)
My implementation
                Training app
           Attend a training event


           UserAttendsEventContext



    user                             event


AttendingRole                  PublicEventRole
attends(event)              attend_on_google(user)
What is it good for?
Kind of awkward to deal with context instances - bad
                implementation?
    Class methods belonging to roles or object?

 Simple console usage must also follow the context


 Easy to find specific methods (if used consistently)
            Fat models go on crash diet!
                  Easy to maintain

          Easy to follow an entire use case
Questions?

Do we need DCI?

More Related Content

What's hot

What's hot (11)

Evolutionary architecture: evolving even the language
Evolutionary architecture: evolving even the languageEvolutionary architecture: evolving even the language
Evolutionary architecture: evolving even the language
 
Chapter 7 achieving object-oriented design
Chapter 7 achieving object-oriented designChapter 7 achieving object-oriented design
Chapter 7 achieving object-oriented design
 
Solid principles, Design Patterns, and Domain Driven Design
Solid principles, Design Patterns, and Domain Driven DesignSolid principles, Design Patterns, and Domain Driven Design
Solid principles, Design Patterns, and Domain Driven Design
 
Low Level Design
Low Level DesignLow Level Design
Low Level Design
 
Object-oriented programming
Object-oriented programmingObject-oriented programming
Object-oriented programming
 
Advanced oop laws, principles, idioms
Advanced oop laws, principles, idiomsAdvanced oop laws, principles, idioms
Advanced oop laws, principles, idioms
 
Object relationship model of software engineering,a subtopic of object orient...
Object relationship model of software engineering,a subtopic of object orient...Object relationship model of software engineering,a subtopic of object orient...
Object relationship model of software engineering,a subtopic of object orient...
 
Design patterns
Design patternsDesign patterns
Design patterns
 
Methodologies in OOAD
Methodologies in OOADMethodologies in OOAD
Methodologies in OOAD
 
Mediator
MediatorMediator
Mediator
 
Sda 8
Sda   8Sda   8
Sda 8
 

Similar to Data Context Interaction - What is it good for?

Object-oriented modeling and design.pdf
Object-oriented modeling and  design.pdfObject-oriented modeling and  design.pdf
Object-oriented modeling and design.pdf
SHIVAM691605
 
Sofwear deasign and need of design pattern
Sofwear deasign and need of design patternSofwear deasign and need of design pattern
Sofwear deasign and need of design pattern
chetankane
 
Design pattern in android
Design pattern in androidDesign pattern in android
Design pattern in android
Jay Kumarr
 
P Training Presentation
P Training PresentationP Training Presentation
P Training Presentation
Gaurav Tyagi
 
Object oriented methodologies
Object oriented methodologiesObject oriented methodologies
Object oriented methodologies
naina-rani
 
Patterns (contd)Software Development ProcessDesign patte.docx
Patterns (contd)Software Development ProcessDesign patte.docxPatterns (contd)Software Development ProcessDesign patte.docx
Patterns (contd)Software Development ProcessDesign patte.docx
danhaley45372
 
Itp oo mand-d
Itp oo mand-dItp oo mand-d
Itp oo mand-d
Shibu S R
 

Similar to Data Context Interaction - What is it good for? (20)

DCI with Ruby and Rails
DCI with Ruby and RailsDCI with Ruby and Rails
DCI with Ruby and Rails
 
Design pattern 1
Design pattern 1Design pattern 1
Design pattern 1
 
Design Pattern Notes: Nagpur University
Design Pattern Notes: Nagpur UniversityDesign Pattern Notes: Nagpur University
Design Pattern Notes: Nagpur University
 
Design patterns
Design patternsDesign patterns
Design patterns
 
Introduction to Design Patterns
Introduction to Design PatternsIntroduction to Design Patterns
Introduction to Design Patterns
 
Object-oriented modeling and design.pdf
Object-oriented modeling and  design.pdfObject-oriented modeling and  design.pdf
Object-oriented modeling and design.pdf
 
Design patterns
Design patternsDesign patterns
Design patterns
 
CAUCE - Model-driven development of ubiquitous computing environments
CAUCE - Model-driven development of ubiquitous computing environmentsCAUCE - Model-driven development of ubiquitous computing environments
CAUCE - Model-driven development of ubiquitous computing environments
 
Sofwear deasign and need of design pattern
Sofwear deasign and need of design patternSofwear deasign and need of design pattern
Sofwear deasign and need of design pattern
 
Design patterns
Design patternsDesign patterns
Design patterns
 
Design pattern in android
Design pattern in androidDesign pattern in android
Design pattern in android
 
P Training Presentation
P Training PresentationP Training Presentation
P Training Presentation
 
Ooad 2
Ooad 2Ooad 2
Ooad 2
 
Ooad
OoadOoad
Ooad
 
Design patterns
Design patternsDesign patterns
Design patterns
 
Object oriented methodologies
Object oriented methodologiesObject oriented methodologies
Object oriented methodologies
 
Jeet ooad unit-2
Jeet ooad unit-2Jeet ooad unit-2
Jeet ooad unit-2
 
Patterns (contd)Software Development ProcessDesign patte.docx
Patterns (contd)Software Development ProcessDesign patte.docxPatterns (contd)Software Development ProcessDesign patte.docx
Patterns (contd)Software Development ProcessDesign patte.docx
 
Typescript design patterns applied to sharepoint framework - Sharepoint Satur...
Typescript design patterns applied to sharepoint framework - Sharepoint Satur...Typescript design patterns applied to sharepoint framework - Sharepoint Satur...
Typescript design patterns applied to sharepoint framework - Sharepoint Satur...
 
Itp oo mand-d
Itp oo mand-dItp oo mand-d
Itp oo mand-d
 

Recently uploaded

CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
giselly40
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
Earley Information Science
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 

Recently uploaded (20)

CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
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...
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
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
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
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
 
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
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 

Data Context Interaction - What is it good for?

  • 1. Data Context Interaction What is it good for? Markus Nordin @mnordin
  • 2. Disclaimer I will for the next 30 minutes talk smack about MVC But i secretly <3 MVC
  • 3. History of DCI Trygve Reenskaugs ideas about role based modeling in early 2000 (same guy who invented MVC in the late seventies) Working design model in 2006 Working prototype in mid 2008 Complement to MVC
  • 4. Why DCI? MVC fails to capture behaviour There's no apparent place to put interactions (exception: simple actions that involves a single object) Model should represent things Things should be stable Natural difference between what an object is and what it does. Why not in the code?
  • 5. Goals with DCI Giving system behaviour first class status Cleanly separate code for rapidly changing behavior from code for slowly changing domain knowledge Object style of thinking that is close to peoples mental models rather than class style
  • 6. Data What the system is Closely corresponds to the Model Reflects the domain structure rather than behaviour
  • 7. Context Context is a class (instance) which enacts one (or more) use cases Instantiated by a user (controller) action Mixes in participating objects with Roles The context is responsible for acting out the use case
  • 8. Interaction What the system does Methods in role modules Implemented by mixing in objects with Roles in a given Context or use case
  • 9. Executing DCI Controller action starts a use case by instansiating a context class The context finds (or creates) the objects that are participating in the use case The context mixes in all the roles needed into the objects The context invokes the role methods on the objects and starts the use case enactment
  • 10. Money transfer example Bank - send money to another account SendMoneyContext account account SourceAccount DestinationAccount send(amount) verify(amount) deposit(amount)
  • 11. My implementation Training app Attend a training event UserAttendsEventContext user event AttendingRole PublicEventRole attends(event) attend_on_google(user)
  • 12. What is it good for? Kind of awkward to deal with context instances - bad implementation? Class methods belonging to roles or object? Simple console usage must also follow the context Easy to find specific methods (if used consistently) Fat models go on crash diet! Easy to maintain Easy to follow an entire use case