Data Context Interaction     What is it good for?       Markus Nordin        @mnordin
DisclaimerI will for the next 30 minutes talk         smack about MVC      But i secretly <3 MVC
History of DCITrygve Reenskaugs ideas about role based modeling in early 2000 (same guy who invented MVC in the late seven...
Why DCI?          MVC fails to capture behaviour Theres no apparent place to put interactions (exception: simple actions t...
Goals with DCI   Giving system behaviour first class status  Cleanly separate code for rapidly changingbehavior from code ...
Data                What the system is         Closely corresponds to the ModelReflects the domain structure rather than b...
Context Context is a class (instance) which enacts one (or                   more) use cases      Instantiated by a user (...
Interaction             What the system does           Methods in role modulesImplemented by mixing in objects with Roles ...
Executing DCIController action starts a use case by instansiating a context                             class     The cont...
Money transfer exampleBank - send money to another account             SendMoneyContext   account                      acc...
My implementation                Training app           Attend a training event           UserAttendsEventContext    user ...
What is it good for?Kind of awkward to deal with context instances - bad                implementation?    Class methods b...
Questions?Do we need DCI?
Upcoming SlideShare
Loading in …5
×

Data Context Interaction - What is it good for?

3,507 views

Published on

Slides for a presentation about Data Context Interaction for the Stockholm Ruby User Group meetup

Published in: Technology, Business
0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
3,507
On SlideShare
0
From Embeds
0
Number of Embeds
19
Actions
Shares
0
Downloads
30
Comments
0
Likes
2
Embeds 0
No embeds

No notes for slide

Data Context Interaction - What is it good for?

  1. 1. Data Context Interaction What is it good for? Markus Nordin @mnordin
  2. 2. DisclaimerI will for the next 30 minutes talk smack about MVC But i secretly <3 MVC
  3. 3. History of DCITrygve 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. 4. Why DCI? MVC fails to capture behaviour Theres no apparent place to put interactions (exception: simple actions that involves a single object) Model should represent things Things should be stableNatural difference between what an object is and what it does. Why not in the code?
  5. 5. Goals with DCI Giving system behaviour first class status Cleanly separate code for rapidly changingbehavior from code for slowly changing domain knowledgeObject style of thinking that is close to peoples mental models rather than class style
  6. 6. Data What the system is Closely corresponds to the ModelReflects the domain structure rather than behaviour
  7. 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 RolesThe context is responsible for acting out the use case
  8. 8. Interaction What the system does Methods in role modulesImplemented by mixing in objects with Roles in a given Context or use case
  9. 9. Executing DCIController 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. 10. Money transfer exampleBank - send money to another account SendMoneyContext account accountSourceAccount DestinationAccount send(amount) verify(amount) deposit(amount)
  11. 11. My implementation Training app Attend a training event UserAttendsEventContext user eventAttendingRole PublicEventRoleattends(event) attend_on_google(user)
  12. 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
  13. 13. Questions?Do we need DCI?

×