DCI @ XING

Preview:

Citation preview

DCI @ XING

hardwiring brainsBoris Tveritnev

XING Architecture at a glance

10/25/2015 DCI @ XING // Boris Tveritnev // XPDays Kiev 2

Index

The problem

Problem by example

DCI

DCI and DDD

DCI and TDD

Application techniques

Takeaway

The

problem(s)Object Oriented Programming

http://donkeykong.wikia.com/wiki/User:CoolHungryYoshi?file=Donkey-kong-clean.gif

“I thought of objects being like biological cells and/or individual computers on a network, only able to communicatewith messages”

Alan Kay

http://userpage.fu-berlin.de/~ram/pub/pub_jf47ht81Ht/doc_kay_oop_en

Something went really wrong

• Simula (1967)

• Smalltalk (1980)

• C++ (1983)

• Java (1995)

• C# (2000)

10/25/2015 DCI @ XING // Boris Tveritnev // XPDays Kiev 6

OOP as it is

•There is little in object orientation, that helps

the developer capture doing in the code

•One can’t reason about system behavior in

runtime

10/25/2015 DCI @ XING // Boris Tveritnev // XPDays Kiev 7

https://s-media-cache-ak0.pinimg.com/736x/c2/02/1c/c2021c66544d3b66495d7d489f527405.jpg

“I made up the term 'object-oriented', and I

can tell you I didn't have C++ in mind”

Alan Kay

OOPSLA '97

Payments

domain@XING

http://www.kimberlywoodstucson.com/uploads/5/5/0/9/55094411/3783591_orig.png

Payments domain model

1010/25/2015 DCI @ XING // Boris Tveritnev // XPDays Kiev

ONLINE OFFLINE IN-APP

BONUS

B2B

customers

B2C

customers

Pay UsePayUsePay Pay Pay PayPay

More

Pay

MoreUse Bonus

Runtime vs design-time

1110/25/2015 DCI @ XING // Boris Tveritnev // XPDays Kiev

Runtime vs design-time

1210/25/2015 DCI @ XING // Boris Tveritnev // XPDays Kiev

Runtime vs design-time

1310/25/2015 DCI @ XING // Boris Tveritnev // XPDays Kiev

Data-Context-

InteractionHardwiring brains

http://1.bp.blogspot.com/_MyFAOEj9GKk/S-QmbuYk56I/AAAAAAAAAEQ/sHc-mwJBacc/s1600/left-brain-right-

brain.jpg

Users’ mental models

•What the system is

•What the system does

10/25/2015 DCI @ XING // Boris Tveritnev // XPDays Kiev 15

Data (Records)

•Data objects express what the system is

•Methods and attributes that describe the data

• In essence they are just dumb DTOs

10/25/2015 DCI @ XING // Boris Tveritnev // XPDays Kiev 16

http://vignette1.wikia.nocookie.net/uncyclopedia/images/3/3a/Pac_man_pie_chart.jpg

Data example

10/25/2015 DCI @ XING // Boris Tveritnev // XPDays Kiev 17

Interaction (Roles)

•Roles describe the algorithms defining what

the system does

•Traits of objects

10/25/2015 DCI @ XING // Boris Tveritnev // XPDays Kiev 18

Roles and Biz Processes

•Customer - Sales

•Debtor - Accounting

•Employer - BizDev

•SupportClient - Support

10/25/2015 DCI @ XING // Boris Tveritnev // XPDays Kiev 19

https://ruthcatchen.files.wordpress.com/2012/03/artclass.jpg

Role example

10/25/2015 DCI @ XING // Boris Tveritnev // XPDays Kiev 20

Context

•Specifies a network of communicating Objects

as interconnected Roles

•Represents a single Use Case

10/25/2015 DCI @ XING // Boris Tveritnev // XPDays Kiev 21

Hide Client Context example

10/25/2015 DCI @ XING // Boris Tveritnev // XPDays Kiev 22

Client Role example

10/25/2015 DCI @ XING // Boris Tveritnev // XPDays Kiev 23

Role example

10/25/2015 DCI @ XING // Boris Tveritnev // XPDays Kiev 24

Renew Contract Context example

10/25/2015 DCI @ XING // Boris Tveritnev // XPDays Kiev 25

Contract Role example

10/25/2015 DCI @ XING // Boris Tveritnev // XPDays Kiev 26

Client Role example

10/25/2015 DCI @ XING // Boris Tveritnev // XPDays Kiev 27

DCI and DDDSwore friends

http://data.whicdn.com/images/67570097/original.gif

Aggregates

10/25/2015 DCI @ XING // Boris Tveritnev // XPDays Kiev 29

•DDD defines Aggregate Root as an invariant

enforcing entry point

•DCI aids in finding correct aggregate

boundaries

http://petroloco.com/wp-content/uploads/2014/01/Disintegrating-01.jpg

Aggregate example

10/25/2015 DCI @ XING // Boris Tveritnev // XPDays Kiev 30

Aggregate example

10/25/2015 DCI @ XING // Boris Tveritnev // XPDays Kiev 31

Perfect match

10/25/2015 DCI @ XING // Boris Tveritnev // XPDays Kiev 32

•DCI context implements a complete Use Case

•Domain events are results of executing a Use

Case

https://s-media-cache-ak0.pinimg.com/736x/7f/f3/7c/7ff37ca2c4d90a56064d0fc3d42ef58a.jpg

Domain events example

10/25/2015 DCI @ XING // Boris Tveritnev // XPDays Kiev 33

Domain events example

10/25/2015 DCI @ XING // Boris Tveritnev // XPDays Kiev 34

Common restrictions

10/25/2015 DCI @ XING // Boris Tveritnev // XPDays Kiev 35

You need neither of them to build this

DCI and TDDRemoving the friction

http://i.dailymail.co.uk/i/pix/2013/02/23/article-2283273-1835CCED000005DC-212_634x438.jpg

Promoting BDD

10/25/2015 DCI @ XING // Boris Tveritnev // XPDays Kiev 37

•Feature-driven top-down approach

•Structures the code and thought

http://www.codelanders.com/wp-content/uploads/2015/04/DDD_TDD_BDD_intersection.png

Zero-friction TDD

10/25/2015 DCI @ XING // Boris Tveritnev // XPDays Kiev 38

•Allows to refactor inner parts without

constantly breaking tests

•With enough attention one can get pretty

close to executable specifications

http://icons.wunderground.com/data/wximagenew/l/ljranch/6.jpg

BDD example

10/25/2015 DCI @ XING // Boris Tveritnev // XPDays Kiev 39

BDD example

10/25/2015 DCI @ XING // Boris Tveritnev // XPDays Kiev 40

BDD example

10/25/2015 DCI @ XING // Boris Tveritnev // XPDays Kiev 41

Application

techniquesDifferent ways in different languages

http://images2.fanpop.com/image/photos/9700000/Penguin-of-Death-penguins-of-madagascar-9714329-800-

600.gif

Libraries/Languages

10/25/2015 DCI @ XING // Boris Tveritnev // XPDays Kiev 43

•C#: with Extension methods or dynamic

•Marvin: .Net CLI compatible language,

designed for DCI

•Ruby: with Method injection or using Maroon

•Javascript: hasOwnProperty and apply

•Java: Apache Zest (former Qi4J)

•Scala: traits

•C++: with Templates

Takeaway

http://personal.lse.ac.uk/robert49/ebooks/PhilSciAdventures/img/memory-brain.jpg

Win!

Touches key areas of agile process

10/25/2015 DCI @ XING // Boris Tveritnev // XPDays Kiev 45

•Analysis with User Stories and Use Cases

•Customer can be closely involved in

discussions

•Embracing change separating stable domain

model from changing User Stories

•Aids in DDD application

•Promotes BDD

www.xing.com

Thank you

for your

attention!

Boris Tveritnev

More info

10/25/2015 DCI @ XING // Boris Tveritnev // XPDays Kiev 47

1. http://www.artima.com/articles/dci_vision.html

2. DCI Glossary: http://folk.uio.no/trygver/2011/DCI-Glossary.pdf

3. http://fulloo.info/

4. https://groups.google.com/forum/#!forum/object-composition

5. Lean Architecture: for Agile Software Development, J. Coplien,

G. Bjørnvig, ISBN-13: 978-0470684207, Wiley, 2010.

6. A Personal Computer for Children of All Ages:

http://www.mprove.de/diplom/gui/Kay72a.pdf

7. Dr. Alan Kay on the Meaning of “Object-Oriented Programming”:

http://userpage.fu-

berlin.de/~ram/pub/pub_jf47ht81Ht/doc_kay_oop_en

Recommended