Your SlideShare is downloading. ×
0
DCI ANUG - 24th November 2010
DCI ANUG - 24th November 2010
DCI ANUG - 24th November 2010
DCI ANUG - 24th November 2010
DCI ANUG - 24th November 2010
DCI ANUG - 24th November 2010
DCI ANUG - 24th November 2010
DCI ANUG - 24th November 2010
DCI ANUG - 24th November 2010
DCI ANUG - 24th November 2010
DCI ANUG - 24th November 2010
DCI ANUG - 24th November 2010
DCI ANUG - 24th November 2010
DCI ANUG - 24th November 2010
DCI ANUG - 24th November 2010
DCI ANUG - 24th November 2010
DCI ANUG - 24th November 2010
DCI ANUG - 24th November 2010
DCI ANUG - 24th November 2010
DCI ANUG - 24th November 2010
DCI ANUG - 24th November 2010
DCI ANUG - 24th November 2010
DCI ANUG - 24th November 2010
DCI ANUG - 24th November 2010
DCI ANUG - 24th November 2010
DCI ANUG - 24th November 2010
DCI ANUG - 24th November 2010
DCI ANUG - 24th November 2010
DCI ANUG - 24th November 2010
DCI ANUG - 24th November 2010
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

DCI ANUG - 24th November 2010

1,687

Published on

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
1,687
On Slideshare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
0
Comments
0
Likes
1
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  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

×