dci - data, context and interaction @ jug genova april 2011
DESCRIPTION
My personal take on the Data, Context and Interaction best practice.TRANSCRIPT
![Page 1: DCI - Data, Context and Interaction @ Jug Genova April 2011](https://reader038.vdocument.in/reader038/viewer/2022102922/5481416fb37959442b8b5dc0/html5/thumbnails/1.jpg)
DCIData, Context and
InteractionFabrizio Giudici, Senior Java Architect
Tidalwave s.a.s - [email protected]
1Wednesday, April 20, 2011
![Page 2: DCI - Data, Context and Interaction @ Jug Genova April 2011](https://reader038.vdocument.in/reader038/viewer/2022102922/5481416fb37959442b8b5dc0/html5/thumbnails/2.jpg)
DCI
About the speaker
2
2Wednesday, April 20, 2011
![Page 3: DCI - Data, Context and Interaction @ Jug Genova April 2011](https://reader038.vdocument.in/reader038/viewer/2022102922/5481416fb37959442b8b5dc0/html5/thumbnails/3.jpg)
DCI
About the speaker
• Senior Software Architect, Mentor, Technical Writer
• Fourteen years of Java experience (JSE, JEE, JME, etc...)
• Sun partner since 1998, Oracle consultant since 2010
• Author of a number of open source projects
• Speaker at JavaOne, Devoxx, Jazoon, JAX and other events
• Member of the NetBeans Dream Team
• Co-leader of JUG Milano
• Java.Net blogger at http://www.java.net/blogs/fabriziogiudici
2
2Wednesday, April 20, 2011
![Page 4: DCI - Data, Context and Interaction @ Jug Genova April 2011](https://reader038.vdocument.in/reader038/viewer/2022102922/5481416fb37959442b8b5dc0/html5/thumbnails/4.jpg)
DCI
Agenda
3
3Wednesday, April 20, 2011
![Page 5: DCI - Data, Context and Interaction @ Jug Genova April 2011](https://reader038.vdocument.in/reader038/viewer/2022102922/5481416fb37959442b8b5dc0/html5/thumbnails/5.jpg)
DCI
Agenda
• Two real world examples
3
3Wednesday, April 20, 2011
![Page 6: DCI - Data, Context and Interaction @ Jug Genova April 2011](https://reader038.vdocument.in/reader038/viewer/2022102922/5481416fb37959442b8b5dc0/html5/thumbnails/6.jpg)
DCI
Agenda
• Two real world examples
• DCI - Basic concepts
3
3Wednesday, April 20, 2011
![Page 7: DCI - Data, Context and Interaction @ Jug Genova April 2011](https://reader038.vdocument.in/reader038/viewer/2022102922/5481416fb37959442b8b5dc0/html5/thumbnails/7.jpg)
DCI
Agenda
• Two real world examples
• DCI - Basic concepts
• DCI - How to implement?
3
3Wednesday, April 20, 2011
![Page 8: DCI - Data, Context and Interaction @ Jug Genova April 2011](https://reader038.vdocument.in/reader038/viewer/2022102922/5481416fb37959442b8b5dc0/html5/thumbnails/8.jpg)
DCI
Agenda
• Two real world examples
• DCI - Basic concepts
• DCI - How to implement?
• Some simple examples
3
3Wednesday, April 20, 2011
![Page 9: DCI - Data, Context and Interaction @ Jug Genova April 2011](https://reader038.vdocument.in/reader038/viewer/2022102922/5481416fb37959442b8b5dc0/html5/thumbnails/9.jpg)
DCI
Agenda
• Two real world examples
• DCI - Basic concepts
• DCI - How to implement?
• Some simple examples
• Abstracting and sweetening
3
3Wednesday, April 20, 2011
![Page 10: DCI - Data, Context and Interaction @ Jug Genova April 2011](https://reader038.vdocument.in/reader038/viewer/2022102922/5481416fb37959442b8b5dc0/html5/thumbnails/10.jpg)
Two real world examples
4Wednesday, April 20, 2011
![Page 11: DCI - Data, Context and Interaction @ Jug Genova April 2011](https://reader038.vdocument.in/reader038/viewer/2022102922/5481416fb37959442b8b5dc0/html5/thumbnails/11.jpg)
DCI
Shameless Plug
5
5Wednesday, April 20, 2011
![Page 12: DCI - Data, Context and Interaction @ Jug Genova April 2011](https://reader038.vdocument.in/reader038/viewer/2022102922/5481416fb37959442b8b5dc0/html5/thumbnails/12.jpg)
DCI
Shameless Plug
• Exercises of Design - my design book...
5
5Wednesday, April 20, 2011
![Page 13: DCI - Data, Context and Interaction @ Jug Genova April 2011](https://reader038.vdocument.in/reader038/viewer/2022102922/5481416fb37959442b8b5dc0/html5/thumbnails/13.jpg)
DCI
Shameless Plug
• Exercises of Design - my design book...
• Just started!
5
5Wednesday, April 20, 2011
![Page 14: DCI - Data, Context and Interaction @ Jug Genova April 2011](https://reader038.vdocument.in/reader038/viewer/2022102922/5481416fb37959442b8b5dc0/html5/thumbnails/14.jpg)
DCI
Shameless Plug
• Exercises of Design - my design book...
• Just started!
• http://exercisesofdesign.java.net
5
5Wednesday, April 20, 2011
![Page 15: DCI - Data, Context and Interaction @ Jug Genova April 2011](https://reader038.vdocument.in/reader038/viewer/2022102922/5481416fb37959442b8b5dc0/html5/thumbnails/15.jpg)
DCI
The Observation API
• A core component of blueBill Mobile
• An application about recording bird observations
• Designed with a high degree of abstraction
6
6Wednesday, April 20, 2011
![Page 16: DCI - Data, Context and Interaction @ Jug Genova April 2011](https://reader038.vdocument.in/reader038/viewer/2022102922/5481416fb37959442b8b5dc0/html5/thumbnails/16.jpg)
DCI
The Observation API
• A core component of blueBill Mobile
• An application about recording bird observations
• Designed with a high degree of abstraction
6
6Wednesday, April 20, 2011
![Page 17: DCI - Data, Context and Interaction @ Jug Genova April 2011](https://reader038.vdocument.in/reader038/viewer/2022102922/5481416fb37959442b8b5dc0/html5/thumbnails/17.jpg)
DCI
The Observation API
• A core component of blueBill Mobile
• An application about recording bird observations
• Designed with a high degree of abstraction
6
6Wednesday, April 20, 2011
![Page 18: DCI - Data, Context and Interaction @ Jug Genova April 2011](https://reader038.vdocument.in/reader038/viewer/2022102922/5481416fb37959442b8b5dc0/html5/thumbnails/18.jpg)
DCI 7
7Wednesday, April 20, 2011
![Page 19: DCI - Data, Context and Interaction @ Jug Genova April 2011](https://reader038.vdocument.in/reader038/viewer/2022102922/5481416fb37959442b8b5dc0/html5/thumbnails/19.jpg)
DCI
The Taxonomy API
• Models the taxonomy of a philogenetic tree
• The standard way of biology for representing living beings species
8
8Wednesday, April 20, 2011
![Page 20: DCI - Data, Context and Interaction @ Jug Genova April 2011](https://reader038.vdocument.in/reader038/viewer/2022102922/5481416fb37959442b8b5dc0/html5/thumbnails/20.jpg)
DCI 9
9Wednesday, April 20, 2011
![Page 21: DCI - Data, Context and Interaction @ Jug Genova April 2011](https://reader038.vdocument.in/reader038/viewer/2022102922/5481416fb37959442b8b5dc0/html5/thumbnails/21.jpg)
DCI - Basic Concepts
10Wednesday, April 20, 2011
![Page 22: DCI - Data, Context and Interaction @ Jug Genova April 2011](https://reader038.vdocument.in/reader038/viewer/2022102922/5481416fb37959442b8b5dc0/html5/thumbnails/22.jpg)
DCI
Data, Context and Interaction
11
11Wednesday, April 20, 2011
![Page 23: DCI - Data, Context and Interaction @ Jug Genova April 2011](https://reader038.vdocument.in/reader038/viewer/2022102922/5481416fb37959442b8b5dc0/html5/thumbnails/23.jpg)
DCI
Data, Context and Interaction
• OOD best practice invented by Trygve Reenskaug
11
11Wednesday, April 20, 2011
![Page 24: DCI - Data, Context and Interaction @ Jug Genova April 2011](https://reader038.vdocument.in/reader038/viewer/2022102922/5481416fb37959442b8b5dc0/html5/thumbnails/24.jpg)
DCI
Data, Context and Interaction
• OOD best practice invented by Trygve Reenskaug
• The formalizer of MVC
11
11Wednesday, April 20, 2011
![Page 25: DCI - Data, Context and Interaction @ Jug Genova April 2011](https://reader038.vdocument.in/reader038/viewer/2022102922/5481416fb37959442b8b5dc0/html5/thumbnails/25.jpg)
DCI
Data, Context and Interaction
• OOD best practice invented by Trygve Reenskaug
• The formalizer of MVC
• Seen as an evolution of MVC
11
11Wednesday, April 20, 2011
![Page 26: DCI - Data, Context and Interaction @ Jug Genova April 2011](https://reader038.vdocument.in/reader038/viewer/2022102922/5481416fb37959442b8b5dc0/html5/thumbnails/26.jpg)
DCI
Data, Context and Interaction
• OOD best practice invented by Trygve Reenskaug
• The formalizer of MVC
• Seen as an evolution of MVC
• But it doesn’t replace it
11
11Wednesday, April 20, 2011
![Page 27: DCI - Data, Context and Interaction @ Jug Genova April 2011](https://reader038.vdocument.in/reader038/viewer/2022102922/5481416fb37959442b8b5dc0/html5/thumbnails/27.jpg)
DCI
Data, Context and Interaction
• OOD best practice invented by Trygve Reenskaug
• The formalizer of MVC
• Seen as an evolution of MVC
• But it doesn’t replace it
• It rather broadens the analysis scope
11
11Wednesday, April 20, 2011
![Page 28: DCI - Data, Context and Interaction @ Jug Genova April 2011](https://reader038.vdocument.in/reader038/viewer/2022102922/5481416fb37959442b8b5dc0/html5/thumbnails/28.jpg)
DCI
Data, Context and Interaction
• OOD best practice invented by Trygve Reenskaug
• The formalizer of MVC
• Seen as an evolution of MVC
• But it doesn’t replace it
• It rather broadens the analysis scope
• http://www.artima.com/articles/dci_vision.html
11
11Wednesday, April 20, 2011
![Page 29: DCI - Data, Context and Interaction @ Jug Genova April 2011](https://reader038.vdocument.in/reader038/viewer/2022102922/5481416fb37959442b8b5dc0/html5/thumbnails/29.jpg)
DCI
DCI - aims
12
12Wednesday, April 20, 2011
![Page 30: DCI - Data, Context and Interaction @ Jug Genova April 2011](https://reader038.vdocument.in/reader038/viewer/2022102922/5481416fb37959442b8b5dc0/html5/thumbnails/30.jpg)
DCI
DCI - aims
• Improve readability of a OO system
12
12Wednesday, April 20, 2011
![Page 31: DCI - Data, Context and Interaction @ Jug Genova April 2011](https://reader038.vdocument.in/reader038/viewer/2022102922/5481416fb37959442b8b5dc0/html5/thumbnails/31.jpg)
DCI
DCI - aims
• Improve readability of a OO system
• Give system behaviour first-class status
12
12Wednesday, April 20, 2011
![Page 32: DCI - Data, Context and Interaction @ Jug Genova April 2011](https://reader038.vdocument.in/reader038/viewer/2022102922/5481416fb37959442b8b5dc0/html5/thumbnails/32.jpg)
DCI
DCI - aims
• Improve readability of a OO system
• Give system behaviour first-class status
• Recover readability of system properties on the whole
12
12Wednesday, April 20, 2011
![Page 33: DCI - Data, Context and Interaction @ Jug Genova April 2011](https://reader038.vdocument.in/reader038/viewer/2022102922/5481416fb37959442b8b5dc0/html5/thumbnails/33.jpg)
DCI
DCI - aims
• Improve readability of a OO system
• Give system behaviour first-class status
• Recover readability of system properties on the whole
• Separate responsibilities for behaviour and domain
12
12Wednesday, April 20, 2011
![Page 34: DCI - Data, Context and Interaction @ Jug Genova April 2011](https://reader038.vdocument.in/reader038/viewer/2022102922/5481416fb37959442b8b5dc0/html5/thumbnails/34.jpg)
DCI
DCI - aims
• Improve readability of a OO system
• Give system behaviour first-class status
• Recover readability of system properties on the whole
• Separate responsibilities for behaviour and domain
• Behaviour: what the system does
12
12Wednesday, April 20, 2011
![Page 35: DCI - Data, Context and Interaction @ Jug Genova April 2011](https://reader038.vdocument.in/reader038/viewer/2022102922/5481416fb37959442b8b5dc0/html5/thumbnails/35.jpg)
DCI
DCI - aims
• Improve readability of a OO system
• Give system behaviour first-class status
• Recover readability of system properties on the whole
• Separate responsibilities for behaviour and domain
• Behaviour: what the system does
• Domain: what the system is
12
12Wednesday, April 20, 2011
![Page 36: DCI - Data, Context and Interaction @ Jug Genova April 2011](https://reader038.vdocument.in/reader038/viewer/2022102922/5481416fb37959442b8b5dc0/html5/thumbnails/36.jpg)
DCI
DCI - aims
• Improve readability of a OO system
• Give system behaviour first-class status
• Recover readability of system properties on the whole
• Separate responsibilities for behaviour and domain
• Behaviour: what the system does
• Domain: what the system is
• Be close to people’s mental model
12
12Wednesday, April 20, 2011
![Page 37: DCI - Data, Context and Interaction @ Jug Genova April 2011](https://reader038.vdocument.in/reader038/viewer/2022102922/5481416fb37959442b8b5dc0/html5/thumbnails/37.jpg)
DCI
DCI - Data
13
13Wednesday, April 20, 2011
![Page 38: DCI - Data, Context and Interaction @ Jug Genova April 2011](https://reader038.vdocument.in/reader038/viewer/2022102922/5481416fb37959442b8b5dc0/html5/thumbnails/38.jpg)
DCI
DCI - Data
• What the system is
13
13Wednesday, April 20, 2011
![Page 39: DCI - Data, Context and Interaction @ Jug Genova April 2011](https://reader038.vdocument.in/reader038/viewer/2022102922/5481416fb37959442b8b5dc0/html5/thumbnails/39.jpg)
DCI
DCI - Data
• What the system is
• Relatively static with relations
13
13Wednesday, April 20, 2011
![Page 40: DCI - Data, Context and Interaction @ Jug Genova April 2011](https://reader038.vdocument.in/reader038/viewer/2022102922/5481416fb37959442b8b5dc0/html5/thumbnails/40.jpg)
DCI
DCI - Data
• What the system is
• Relatively static with relations
• Domain structure implemented with “conventional” classes
13
13Wednesday, April 20, 2011
![Page 41: DCI - Data, Context and Interaction @ Jug Genova April 2011](https://reader038.vdocument.in/reader038/viewer/2022102922/5481416fb37959442b8b5dc0/html5/thumbnails/41.jpg)
DCI
DCI - Data
• What the system is
• Relatively static with relations
• Domain structure implemented with “conventional” classes
• Typically it includes persistence
13
13Wednesday, April 20, 2011
![Page 42: DCI - Data, Context and Interaction @ Jug Genova April 2011](https://reader038.vdocument.in/reader038/viewer/2022102922/5481416fb37959442b8b5dc0/html5/thumbnails/42.jpg)
DCI
DCI - Data
• What the system is
• Relatively static with relations
• Domain structure implemented with “conventional” classes
• Typically it includes persistence
• Comes from the mental model of system stakeholders
13
13Wednesday, April 20, 2011
![Page 43: DCI - Data, Context and Interaction @ Jug Genova April 2011](https://reader038.vdocument.in/reader038/viewer/2022102922/5481416fb37959442b8b5dc0/html5/thumbnails/43.jpg)
DCI
DCI - Data
• What the system is
• Relatively static with relations
• Domain structure implemented with “conventional” classes
• Typically it includes persistence
• Comes from the mental model of system stakeholders
• Close to the “model” in MVC
13
13Wednesday, April 20, 2011
![Page 44: DCI - Data, Context and Interaction @ Jug Genova April 2011](https://reader038.vdocument.in/reader038/viewer/2022102922/5481416fb37959442b8b5dc0/html5/thumbnails/44.jpg)
DCI
DCI - Data
• What the system is
• Relatively static with relations
• Domain structure implemented with “conventional” classes
• Typically it includes persistence
• Comes from the mental model of system stakeholders
• Close to the “model” in MVC
• Example: BankAccount with increase(), decrease(); no deposit()
13
13Wednesday, April 20, 2011
![Page 45: DCI - Data, Context and Interaction @ Jug Genova April 2011](https://reader038.vdocument.in/reader038/viewer/2022102922/5481416fb37959442b8b5dc0/html5/thumbnails/45.jpg)
DCI
DCI - Context (and Roles)
14
14Wednesday, April 20, 2011
![Page 46: DCI - Data, Context and Interaction @ Jug Genova April 2011](https://reader038.vdocument.in/reader038/viewer/2022102922/5481416fb37959442b8b5dc0/html5/thumbnails/46.jpg)
DCI
DCI - Context (and Roles)
• Associated to a use case, user story, scenario, or algorithm
14
14Wednesday, April 20, 2011
![Page 47: DCI - Data, Context and Interaction @ Jug Genova April 2011](https://reader038.vdocument.in/reader038/viewer/2022102922/5481416fb37959442b8b5dc0/html5/thumbnails/47.jpg)
DCI
DCI - Context (and Roles)
• Associated to a use case, user story, scenario, or algorithm
• Identifies objects participating in a scenario
14
14Wednesday, April 20, 2011
![Page 48: DCI - Data, Context and Interaction @ Jug Genova April 2011](https://reader038.vdocument.in/reader038/viewer/2022102922/5481416fb37959442b8b5dc0/html5/thumbnails/48.jpg)
DCI
DCI - Context (and Roles)
• Associated to a use case, user story, scenario, or algorithm
• Identifies objects participating in a scenario
• Assign to each object one or more stateless roles
14
14Wednesday, April 20, 2011
![Page 49: DCI - Data, Context and Interaction @ Jug Genova April 2011](https://reader038.vdocument.in/reader038/viewer/2022102922/5481416fb37959442b8b5dc0/html5/thumbnails/49.jpg)
DCI
DCI - Context (and Roles)
• Associated to a use case, user story, scenario, or algorithm
• Identifies objects participating in a scenario
• Assign to each object one or more stateless roles
• Objects can have multiple roles at the same time
14
14Wednesday, April 20, 2011
![Page 50: DCI - Data, Context and Interaction @ Jug Genova April 2011](https://reader038.vdocument.in/reader038/viewer/2022102922/5481416fb37959442b8b5dc0/html5/thumbnails/50.jpg)
DCI
DCI - Context (and Roles)
• Associated to a use case, user story, scenario, or algorithm
• Identifies objects participating in a scenario
• Assign to each object one or more stateless roles
• Objects can have multiple roles at the same time
• Decompose the use case (etc...) into roles, not objects
14
14Wednesday, April 20, 2011
![Page 51: DCI - Data, Context and Interaction @ Jug Genova April 2011](https://reader038.vdocument.in/reader038/viewer/2022102922/5481416fb37959442b8b5dc0/html5/thumbnails/51.jpg)
DCI
DCI - Context (and Roles)
• Associated to a use case, user story, scenario, or algorithm
• Identifies objects participating in a scenario
• Assign to each object one or more stateless roles
• Objects can have multiple roles at the same time
• Decompose the use case (etc...) into roles, not objects
• Contrast this with polymorphism and classic OO decomposition
14
14Wednesday, April 20, 2011
![Page 52: DCI - Data, Context and Interaction @ Jug Genova April 2011](https://reader038.vdocument.in/reader038/viewer/2022102922/5481416fb37959442b8b5dc0/html5/thumbnails/52.jpg)
DCI
DCI - Context (and Roles)
• Associated to a use case, user story, scenario, or algorithm
• Identifies objects participating in a scenario
• Assign to each object one or more stateless roles
• Objects can have multiple roles at the same time
• Decompose the use case (etc...) into roles, not objects
• Contrast this with polymorphism and classic OO decomposition
• Example: MoneyTransfer with SrcAccount and DestAccount
14
14Wednesday, April 20, 2011
![Page 53: DCI - Data, Context and Interaction @ Jug Genova April 2011](https://reader038.vdocument.in/reader038/viewer/2022102922/5481416fb37959442b8b5dc0/html5/thumbnails/53.jpg)
DCI
Quick terminology note
15
15Wednesday, April 20, 2011
![Page 54: DCI - Data, Context and Interaction @ Jug Genova April 2011](https://reader038.vdocument.in/reader038/viewer/2022102922/5481416fb37959442b8b5dc0/html5/thumbnails/54.jpg)
DCI
Quick terminology note
• Methodless role: abstract role
15
15Wednesday, April 20, 2011
![Page 55: DCI - Data, Context and Interaction @ Jug Genova April 2011](https://reader038.vdocument.in/reader038/viewer/2022102922/5481416fb37959442b8b5dc0/html5/thumbnails/55.jpg)
DCI
Quick terminology note
• Methodless role: abstract role
• Interface, abstract class
15
15Wednesday, April 20, 2011
![Page 56: DCI - Data, Context and Interaction @ Jug Genova April 2011](https://reader038.vdocument.in/reader038/viewer/2022102922/5481416fb37959442b8b5dc0/html5/thumbnails/56.jpg)
DCI
Quick terminology note
• Methodless role: abstract role
• Interface, abstract class
• Methodful role: concrete role
15
15Wednesday, April 20, 2011
![Page 57: DCI - Data, Context and Interaction @ Jug Genova April 2011](https://reader038.vdocument.in/reader038/viewer/2022102922/5481416fb37959442b8b5dc0/html5/thumbnails/57.jpg)
DCI
Quick terminology note
• Methodless role: abstract role
• Interface, abstract class
• Methodful role: concrete role
• Regular class
15
15Wednesday, April 20, 2011
![Page 58: DCI - Data, Context and Interaction @ Jug Genova April 2011](https://reader038.vdocument.in/reader038/viewer/2022102922/5481416fb37959442b8b5dc0/html5/thumbnails/58.jpg)
DCI
DCI - Interaction
16
16Wednesday, April 20, 2011
![Page 59: DCI - Data, Context and Interaction @ Jug Genova April 2011](https://reader038.vdocument.in/reader038/viewer/2022102922/5481416fb37959442b8b5dc0/html5/thumbnails/59.jpg)
DCI
DCI - Interaction
• What the system does
16
16Wednesday, April 20, 2011
![Page 60: DCI - Data, Context and Interaction @ Jug Genova April 2011](https://reader038.vdocument.in/reader038/viewer/2022102922/5481416fb37959442b8b5dc0/html5/thumbnails/60.jpg)
DCI
DCI - Interaction
• What the system does
• Occurs among roles, which act as adapters to objects
16
16Wednesday, April 20, 2011
![Page 61: DCI - Data, Context and Interaction @ Jug Genova April 2011](https://reader038.vdocument.in/reader038/viewer/2022102922/5481416fb37959442b8b5dc0/html5/thumbnails/61.jpg)
DCI
DCI - Interaction
• What the system does
• Occurs among roles, which act as adapters to objects
• Roles are bound in different ways for each context
16
16Wednesday, April 20, 2011
![Page 62: DCI - Data, Context and Interaction @ Jug Genova April 2011](https://reader038.vdocument.in/reader038/viewer/2022102922/5481416fb37959442b8b5dc0/html5/thumbnails/62.jpg)
DCI
DCI - Interaction
• What the system does
• Occurs among roles, which act as adapters to objects
• Roles are bound in different ways for each context
• Roles should be generic
16
16Wednesday, April 20, 2011
![Page 63: DCI - Data, Context and Interaction @ Jug Genova April 2011](https://reader038.vdocument.in/reader038/viewer/2022102922/5481416fb37959442b8b5dc0/html5/thumbnails/63.jpg)
DCI
DCI - Interaction
• What the system does
• Occurs among roles, which act as adapters to objects
• Roles are bound in different ways for each context
• Roles should be generic
• Roles life cycle is likely to be bound to a given interaction
16
16Wednesday, April 20, 2011
![Page 64: DCI - Data, Context and Interaction @ Jug Genova April 2011](https://reader038.vdocument.in/reader038/viewer/2022102922/5481416fb37959442b8b5dc0/html5/thumbnails/64.jpg)
DCI
DCI - Interaction
• What the system does
• Occurs among roles, which act as adapters to objects
• Roles are bound in different ways for each context
• Roles should be generic
• Roles life cycle is likely to be bound to a given interaction
• Interaction should be explicit given role nature, rather than emergent as in (agile) OOD
16
16Wednesday, April 20, 2011
![Page 65: DCI - Data, Context and Interaction @ Jug Genova April 2011](https://reader038.vdocument.in/reader038/viewer/2022102922/5481416fb37959442b8b5dc0/html5/thumbnails/65.jpg)
DCI
DCI - Execution Model
17
17Wednesday, April 20, 2011
![Page 66: DCI - Data, Context and Interaction @ Jug Genova April 2011](https://reader038.vdocument.in/reader038/viewer/2022102922/5481416fb37959442b8b5dc0/html5/thumbnails/66.jpg)
DCI
DCI - Execution Model
• The Context finds object participants
17
17Wednesday, April 20, 2011
![Page 67: DCI - Data, Context and Interaction @ Jug Genova April 2011](https://reader038.vdocument.in/reader038/viewer/2022102922/5481416fb37959442b8b5dc0/html5/thumbnails/67.jpg)
DCI
DCI - Execution Model
• The Context finds object participants
• Then, it assigns (injects?) roles to them
17
17Wednesday, April 20, 2011
![Page 68: DCI - Data, Context and Interaction @ Jug Genova April 2011](https://reader038.vdocument.in/reader038/viewer/2022102922/5481416fb37959442b8b5dc0/html5/thumbnails/68.jpg)
DCI
DCI - Execution Model
• The Context finds object participants
• Then, it assigns (injects?) roles to them
• Roles find each other by type (methodless)
17
17Wednesday, April 20, 2011
![Page 69: DCI - Data, Context and Interaction @ Jug Genova April 2011](https://reader038.vdocument.in/reader038/viewer/2022102922/5481416fb37959442b8b5dc0/html5/thumbnails/69.jpg)
DCI
DCI - Execution Model
• The Context finds object participants
• Then, it assigns (injects?) roles to them
• Roles find each other by type (methodless)
• What about static languages and designs?
17
17Wednesday, April 20, 2011
![Page 70: DCI - Data, Context and Interaction @ Jug Genova April 2011](https://reader038.vdocument.in/reader038/viewer/2022102922/5481416fb37959442b8b5dc0/html5/thumbnails/70.jpg)
DCI
DCI - Execution Model
• The Context finds object participants
• Then, it assigns (injects?) roles to them
• Roles find each other by type (methodless)
• What about static languages and designs?
• Then, it invokes a method on the first role
17
17Wednesday, April 20, 2011
![Page 71: DCI - Data, Context and Interaction @ Jug Genova April 2011](https://reader038.vdocument.in/reader038/viewer/2022102922/5481416fb37959442b8b5dc0/html5/thumbnails/71.jpg)
DCI
DCI - Execution Model
• The Context finds object participants
• Then, it assigns (injects?) roles to them
• Roles find each other by type (methodless)
• What about static languages and designs?
• Then, it invokes a method on the first role
• Interaction goes on among other roles
17
17Wednesday, April 20, 2011
![Page 72: DCI - Data, Context and Interaction @ Jug Genova April 2011](https://reader038.vdocument.in/reader038/viewer/2022102922/5481416fb37959442b8b5dc0/html5/thumbnails/72.jpg)
DCI - How to implement?
18Wednesday, April 20, 2011
![Page 73: DCI - Data, Context and Interaction @ Jug Genova April 2011](https://reader038.vdocument.in/reader038/viewer/2022102922/5481416fb37959442b8b5dc0/html5/thumbnails/73.jpg)
DCI
Some design issues
19
19Wednesday, April 20, 2011
![Page 74: DCI - Data, Context and Interaction @ Jug Genova April 2011](https://reader038.vdocument.in/reader038/viewer/2022102922/5481416fb37959442b8b5dc0/html5/thumbnails/74.jpg)
DCI
Some design issues
• Static vs dynamic
19
19Wednesday, April 20, 2011
![Page 75: DCI - Data, Context and Interaction @ Jug Genova April 2011](https://reader038.vdocument.in/reader038/viewer/2022102922/5481416fb37959442b8b5dc0/html5/thumbnails/75.jpg)
DCI
Some design issues
• Static vs dynamic
• Traits, Mix-ins
19
19Wednesday, April 20, 2011
![Page 76: DCI - Data, Context and Interaction @ Jug Genova April 2011](https://reader038.vdocument.in/reader038/viewer/2022102922/5481416fb37959442b8b5dc0/html5/thumbnails/76.jpg)
DCI
Some design issues
• Static vs dynamic
• Traits, Mix-ins
• AOP, annotations (e.g. Qi4J)
19
19Wednesday, April 20, 2011
![Page 77: DCI - Data, Context and Interaction @ Jug Genova April 2011](https://reader038.vdocument.in/reader038/viewer/2022102922/5481416fb37959442b8b5dc0/html5/thumbnails/77.jpg)
DCI
Some design issues
• Static vs dynamic
• Traits, Mix-ins
• AOP, annotations (e.g. Qi4J)
• Problems: schizophrenia
19
19Wednesday, April 20, 2011
![Page 78: DCI - Data, Context and Interaction @ Jug Genova April 2011](https://reader038.vdocument.in/reader038/viewer/2022102922/5481416fb37959442b8b5dc0/html5/thumbnails/78.jpg)
DCI
Some design issues
• Static vs dynamic
• Traits, Mix-ins
• AOP, annotations (e.g. Qi4J)
• Problems: schizophrenia
• Which is the identity of an object that becomes a cluster of roles
19
19Wednesday, April 20, 2011
![Page 79: DCI - Data, Context and Interaction @ Jug Genova April 2011](https://reader038.vdocument.in/reader038/viewer/2022102922/5481416fb37959442b8b5dc0/html5/thumbnails/79.jpg)
DCI
Some design issues
• Static vs dynamic
• Traits, Mix-ins
• AOP, annotations (e.g. Qi4J)
• Problems: schizophrenia
• Which is the identity of an object that becomes a cluster of roles
• Partly solved by the clear separation object (stateful) / role (stateless)
19
19Wednesday, April 20, 2011
![Page 80: DCI - Data, Context and Interaction @ Jug Genova April 2011](https://reader038.vdocument.in/reader038/viewer/2022102922/5481416fb37959442b8b5dc0/html5/thumbnails/80.jpg)
DCI
Some design issues
• Static vs dynamic
• Traits, Mix-ins
• AOP, annotations (e.g. Qi4J)
• Problems: schizophrenia
• Which is the identity of an object that becomes a cluster of roles
• Partly solved by the clear separation object (stateful) / role (stateless)
• What about equals() / hashcode()?
19
19Wednesday, April 20, 2011
![Page 81: DCI - Data, Context and Interaction @ Jug Genova April 2011](https://reader038.vdocument.in/reader038/viewer/2022102922/5481416fb37959442b8b5dc0/html5/thumbnails/81.jpg)
DCI
Some design issues
• Static vs dynamic
• Traits, Mix-ins
• AOP, annotations (e.g. Qi4J)
• Problems: schizophrenia
• Which is the identity of an object that becomes a cluster of roles
• Partly solved by the clear separation object (stateful) / role (stateless)
• What about equals() / hashcode()?
• Problem: anemic objects
19
19Wednesday, April 20, 2011
![Page 82: DCI - Data, Context and Interaction @ Jug Genova April 2011](https://reader038.vdocument.in/reader038/viewer/2022102922/5481416fb37959442b8b5dc0/html5/thumbnails/82.jpg)
DCI
Some design issues
• Static vs dynamic
• Traits, Mix-ins
• AOP, annotations (e.g. Qi4J)
• Problems: schizophrenia
• Which is the identity of an object that becomes a cluster of roles
• Partly solved by the clear separation object (stateful) / role (stateless)
• What about equals() / hashcode()?
• Problem: anemic objects
• Really a problem in this perspective?19
19Wednesday, April 20, 2011
![Page 83: DCI - Data, Context and Interaction @ Jug Genova April 2011](https://reader038.vdocument.in/reader038/viewer/2022102922/5481416fb37959442b8b5dc0/html5/thumbnails/83.jpg)
DCI
Designing with DCI
20
20Wednesday, April 20, 2011
![Page 84: DCI - Data, Context and Interaction @ Jug Genova April 2011](https://reader038.vdocument.in/reader038/viewer/2022102922/5481416fb37959442b8b5dc0/html5/thumbnails/84.jpg)
DCI
Designing with DCI
• First, acknowledge that DCI is a best practice
20
20Wednesday, April 20, 2011
![Page 85: DCI - Data, Context and Interaction @ Jug Genova April 2011](https://reader038.vdocument.in/reader038/viewer/2022102922/5481416fb37959442b8b5dc0/html5/thumbnails/85.jpg)
DCI
Designing with DCI
• First, acknowledge that DCI is a best practice
• Some languages can fit better than others
20
20Wednesday, April 20, 2011
![Page 86: DCI - Data, Context and Interaction @ Jug Genova April 2011](https://reader038.vdocument.in/reader038/viewer/2022102922/5481416fb37959442b8b5dc0/html5/thumbnails/86.jpg)
DCI
Designing with DCI
• First, acknowledge that DCI is a best practice
• Some languages can fit better than others
• Frameworks might help... but they force a new nature
20
20Wednesday, April 20, 2011
![Page 87: DCI - Data, Context and Interaction @ Jug Genova April 2011](https://reader038.vdocument.in/reader038/viewer/2022102922/5481416fb37959442b8b5dc0/html5/thumbnails/87.jpg)
DCI
Designing with DCI
• First, acknowledge that DCI is a best practice
• Some languages can fit better than others
• Frameworks might help... but they force a new nature
• My point: DCI must be addressed in design
20
20Wednesday, April 20, 2011
![Page 88: DCI - Data, Context and Interaction @ Jug Genova April 2011](https://reader038.vdocument.in/reader038/viewer/2022102922/5481416fb37959442b8b5dc0/html5/thumbnails/88.jpg)
Some UI-oriented examples
21Wednesday, April 20, 2011
![Page 89: DCI - Data, Context and Interaction @ Jug Genova April 2011](https://reader038.vdocument.in/reader038/viewer/2022102922/5481416fb37959442b8b5dc0/html5/thumbnails/89.jpg)
DCI
NodesExample 1
• Static role implementation
• Introduce some generic, (G)UI oriented roles
• NetBeans Platform’s Lookup based implementation
22
22Wednesday, April 20, 2011
![Page 90: DCI - Data, Context and Interaction @ Jug Genova April 2011](https://reader038.vdocument.in/reader038/viewer/2022102922/5481416fb37959442b8b5dc0/html5/thumbnails/90.jpg)
DCI
NodesExample 2
• Dynamically replacing roles with decorators
23
23Wednesday, April 20, 2011
![Page 91: DCI - Data, Context and Interaction @ Jug Genova April 2011](https://reader038.vdocument.in/reader038/viewer/2022102922/5481416fb37959442b8b5dc0/html5/thumbnails/91.jpg)
DCI
NodesExample 4
• Adding contextual Actions and ToolTips
24
24Wednesday, April 20, 2011
![Page 92: DCI - Data, Context and Interaction @ Jug Genova April 2011](https://reader038.vdocument.in/reader038/viewer/2022102922/5481416fb37959442b8b5dc0/html5/thumbnails/92.jpg)
DCI
NodesExample 5
• Removing UI dependencied
25
25Wednesday, April 20, 2011
![Page 93: DCI - Data, Context and Interaction @ Jug Genova April 2011](https://reader038.vdocument.in/reader038/viewer/2022102922/5481416fb37959442b8b5dc0/html5/thumbnails/93.jpg)
DCI
NodesExample 6
• Injecting roles from the Context
26
26Wednesday, April 20, 2011
![Page 94: DCI - Data, Context and Interaction @ Jug Genova April 2011](https://reader038.vdocument.in/reader038/viewer/2022102922/5481416fb37959442b8b5dc0/html5/thumbnails/94.jpg)
DCI
NodesExample 7
• Injecting Roles in function of the Context
27
27Wednesday, April 20, 2011
![Page 95: DCI - Data, Context and Interaction @ Jug Genova April 2011](https://reader038.vdocument.in/reader038/viewer/2022102922/5481416fb37959442b8b5dc0/html5/thumbnails/95.jpg)
Abstracting and sweetening
28Wednesday, April 20, 2011
![Page 96: DCI - Data, Context and Interaction @ Jug Genova April 2011](https://reader038.vdocument.in/reader038/viewer/2022102922/5481416fb37959442b8b5dc0/html5/thumbnails/96.jpg)
DCI
Abstracting and sweetening
• Would be nice to be technology independent
• Would be nice to have some syntactic sugar
29
29Wednesday, April 20, 2011
![Page 97: DCI - Data, Context and Interaction @ Jug Genova April 2011](https://reader038.vdocument.in/reader038/viewer/2022102922/5481416fb37959442b8b5dc0/html5/thumbnails/97.jpg)
DCI
as()
30
30Wednesday, April 20, 2011
![Page 98: DCI - Data, Context and Interaction @ Jug Genova April 2011](https://reader038.vdocument.in/reader038/viewer/2022102922/5481416fb37959442b8b5dc0/html5/thumbnails/98.jpg)
DCI
as()
• From Role role = object.getLookup().lookup(Role.class) ...
30
30Wednesday, April 20, 2011
![Page 99: DCI - Data, Context and Interaction @ Jug Genova April 2011](https://reader038.vdocument.in/reader038/viewer/2022102922/5481416fb37959442b8b5dc0/html5/thumbnails/99.jpg)
DCI
as()
• From Role role = object.getLookup().lookup(Role.class) ...
• ... to Role role = object.as(Role);
30
30Wednesday, April 20, 2011
![Page 100: DCI - Data, Context and Interaction @ Jug Genova April 2011](https://reader038.vdocument.in/reader038/viewer/2022102922/5481416fb37959442b8b5dc0/html5/thumbnails/100.jpg)
DCI
as()
• From Role role = object.getLookup().lookup(Role.class) ...
• ... to Role role = object.as(Role);
• As a wrapper around Lookup
30
30Wednesday, April 20, 2011
![Page 101: DCI - Data, Context and Interaction @ Jug Genova April 2011](https://reader038.vdocument.in/reader038/viewer/2022102922/5481416fb37959442b8b5dc0/html5/thumbnails/101.jpg)
DCI
as()
• From Role role = object.getLookup().lookup(Role.class) ...
• ... to Role role = object.as(Role);
• As a wrapper around Lookup
• With annotations and Lombok
30
30Wednesday, April 20, 2011
![Page 102: DCI - Data, Context and Interaction @ Jug Genova April 2011](https://reader038.vdocument.in/reader038/viewer/2022102922/5481416fb37959442b8b5dc0/html5/thumbnails/102.jpg)
DCI
as()
• From Role role = object.getLookup().lookup(Role.class) ...
• ... to Role role = object.as(Role);
• As a wrapper around Lookup
• With annotations and Lombok
30
@AsCapablepublic class MyObject { @Role private Role1 r1 = new Role1();
@Role // lazy private Provider<Role> r2 = ...; }
30Wednesday, April 20, 2011
![Page 103: DCI - Data, Context and Interaction @ Jug Genova April 2011](https://reader038.vdocument.in/reader038/viewer/2022102922/5481416fb37959442b8b5dc0/html5/thumbnails/103.jpg)
DCI
Q & A
• Question Time
31
31Wednesday, April 20, 2011