Slide 1

Slide 1 text

IBM Cloud / February 9, 2018 / © 2018 IBM Corporation Domain-Driven Data — Bradley Holt Developer Advocate Senior Software Engineer

Slide 2

Slide 2 text

No content

Slide 3

Slide 3 text

No content

Slide 4

Slide 4 text

A fully-managed database-as-a-service (DBaaS) based on Apache CouchDB with additional full text and geospatial search capabilities IBM Cloud / February 9, 2018 / © 2018 IBM Corporation

Slide 5

Slide 5 text

Open for Data Dome (outside) by Bradley Holt.

Slide 6

Slide 6 text

Brent Spiner with Zoltar from Big by Bradley Holt, on Twitter . Big Data

Slide 7

Slide 7 text

IBM Cloud Data Services IBM Cloud / February 9, 2018 / © 2018 IBM Corporation

Slide 8

Slide 8 text

IBM Cloud / February 9, 2018 / © 2018 IBM Corporation A Brief History of Data

Slide 9

Slide 9 text

IBM Cloud / February 9, 2018 / © 2018 IBM Corporation The Relational Database order *order_id customer_id date customer line_item *customer_id email_address name *order_id *item_id price quantity database 2 by Tim Morgan, on Flickr (CC BY 2.0).

Slide 10

Slide 10 text

Relational databases guarantee atomicity, consistency, isolation, and durability (ACID) IBM Cloud / February 9, 2018 / © 2018 IBM Corporation Hard Disk by Jeff Kubina, on Flickr (CC BY-SA 2.0).

Slide 11

Slide 11 text

The ACID guarantees provided by relational databases were (and often still are) critical for systems of record IBM Cloud / February 9, 2018 / © 2018 IBM Corporation IBM 360 Announcement center by Robert Nix, on Flickr (CC BY 2.0).

Slide 12

Slide 12 text

The introduction of the Web brought new types of applications with different constraints than systems of record IBM Cloud / February 9, 2018 / © 2018 IBM Corporation Dialing Up Web History by Mike Licht, on Flickr (CC BY 2.0).

Slide 13

Slide 13 text

The introduction of mobile apps added to the growing number of systems of engagement IBM Cloud / February 9, 2018 / © 2018 IBM Corporation Instagram and other Social Media Apps by Jason Howie, on Flickr (CC BY 2.0).

Slide 14

Slide 14 text

IBM Cloud / February 9, 2018 / © 2018 IBM Corporation Changing Constraints

Slide 15

Slide 15 text

IBM Cloud / February 9, 2018 / © 2018 IBM Corporation Always On Dynamo, un siècle de lumière et de mouvement dans l'art, 1913 – 2013 by Yann Caradec, on Flickr (CC BY-SA 2.0).

Slide 16

Slide 16 text

IBM Cloud / February 9, 2018 / © 2018 IBM Corporation Big Data World travel and communications recorded on Twitter by Eric Fischer, on Flickr (CC BY 2.0).

Slide 17

Slide 17 text

IBM Cloud / February 9, 2018 / © 2018 IBM Corporation The CAP Theorem Consistency Availability Partition Tolerance

Slide 18

Slide 18 text

Horizontal scaling through the addition of commodity hardware IBM Cloud / February 9, 2018 / © 2018 IBM Corporation Server grill with blue light by David Precious, on Flickr (CC BY 2.0).

Slide 19

Slide 19 text

Every node in an eventually consistent distributed system will eventually arrive at a consistent state if given no new updates IBM Cloud / February 9, 2018 / © 2018 IBM Corporation Spider Web by Alden Chadwick, on Flickr (CC BY 2.0).

Slide 20

Slide 20 text

IBM Cloud / February 9, 2018 / © 2018 IBM Corporation Enter “Not only SQL” (NoSQL)

Slide 21

Slide 21 text

IBM Cloud / February 9, 2018 / © 2018 IBM Corporation key-value graph document …more database by Tim Morgan, on Flickr (CC BY 2.0).

Slide 22

Slide 22 text

IBM Cloud / February 9, 2018 / © 2018 IBM Corporation

Slide 23

Slide 23 text

Key-value stores provide opaque data accessed through unique keys IBM Cloud / February 9, 2018 / © 2018 IBM Corporation Keys for the Stanley Hotel by Mike Silva, on Flickr (CC BY 2.0).

Slide 24

Slide 24 text

Document databases are a variation on key- value stores with strictly defined values (e.g. JSON objects) IBM Cloud / February 9, 2018 / © 2018 IBM Corporation paper by malik, on Flickr (CC BY-ND 2.0).

Slide 25

Slide 25 text

Graph databases provide nodes and properties of nodes connected via edges IBM Cloud / February 9, 2018 / © 2018 IBM Corporation Edinburgh Road Network analysis by Steven Kay, on Flickr (CC BY-ND 2.0).

Slide 26

Slide 26 text

IBM Cloud / February 9, 2018 / © 2018 IBM Corporation Domain-Driven Design (DDD)

Slide 27

Slide 27 text

No content

Slide 28

Slide 28 text

Domain-Driven Design is a collaboration between domain experts and software practitioners IBM Cloud / February 9, 2018 / © 2018 IBM Corporation IMG_2619 by Jason Pelletier, on Flickr (CC BY-SA 2.0).

Slide 29

Slide 29 text

Complexity is in the domain, not in the technology IBM Cloud / February 9, 2018 / © 2018 IBM Corporation Sounds_of_Complexity11.jpg by Enzo Varriale, on Flickr (CC BY-ND 2.0).

Slide 30

Slide 30 text

Models are tools used to solve problems within the domain IBM Cloud / February 9, 2018 / © 2018 IBM Corporation model by MaZzuk, on Flickr (CC BY 2.0).

Slide 31

Slide 31 text

Don't confuse models with reality—the map is not the territory IBM Cloud / February 9, 2018 / © 2018 IBM Corporation taking the subway to find the rents by Eli Duke, on Flickr (CC BY-SA 2.0).

Slide 32

Slide 32 text

IBM Cloud / February 9, 2018 / © 2018 IBM Corporation Building Blocks of DDD and Domain Object Life Cycle

Slide 33

Slide 33 text

Entities are defined by their identity IBM Cloud / February 9, 2018 / © 2018 IBM Corporation DSC_3407 by Mad House Photography, on Flickr (CC BY 2.0).

Slide 34

Slide 34 text

Value objects encode attributes that describe things IBM Cloud / February 9, 2018 / © 2018 IBM Corporation red numbers by DaveBleasdale, on Flickr (CC BY 2.0).

Slide 35

Slide 35 text

Aggregates group related entities to minimize complexity IBM Cloud / February 9, 2018 / © 2018 IBM Corporation Social graph by Dmitry Grigoriev, on Flickr (CC BY 2.0).

Slide 36

Slide 36 text

Repositories provides the illusion of in- memory data stores IBM Cloud / February 9, 2018 / © 2018 IBM Corporation Catalog. by Adam Mayer, on Flickr (CC BY-SA 2.0).

Slide 37

Slide 37 text

IBM Cloud / February 9, 2018 / © 2018 IBM Corporation Domain Layer Order Aggregate «interface» OrderRepository + insertOrder(order:Order) + updateOrder(order:Order) + findOrderById(id:int) : Order + recentOrders([limit:int]) : Order[0..*] Customer … Infrastructure Layer LineItem … Order - id : int - customer : Customer - date : Date - lineItems : LineItem[1..*] + total() : Money InMemoryOrderRepository + insertOrder(order:Order) + updateOrder(order:Order) + findOrderById(id:int) : Order + recentOrders(limit:int) : Order[0..*] RelationalMapperOrderRepository + insertOrder(order:Order) + updateOrder(order:Order) + findOrderById(id:int) : Order + recentOrders(limit:int) : Order[0..*]

Slide 38

Slide 38 text

IBM Cloud / February 9, 2018 / © 2018 IBM Corporation Choosing the Right Data Layer

Slide 39

Slide 39 text

A repository cannot completely abstract the constraints of your data store IBM Cloud / February 9, 2018 / © 2018 IBM Corporation Lina Bo Bardi, SESC Pompéia by paulisson miura, on Flickr (CC BY 2.0).

Slide 40

Slide 40 text

Object-oriented programming and relational databases use different models, resuting in the object-relational impedance mismatch IBM Cloud / February 9, 2018 / © 2018 IBM Corporation Financial District Classical Building Reflection Distortion, San Francisco, California, USA by Wonderlane, on Flickr (CC BY 2.0).

Slide 41

Slide 41 text

“This is the world of NoSQL to me, that we can choose a tool that fits well with the problem we’re trying to solve.” Eric Evans (author of Domain-Driven Design) Software Engineering Radio Episode 226: Eric Evans on Domain-Driven Design at 10 Years, 2015 IBM Cloud / February 9, 2018 / © 2018 IBM Corporation http://www.se-radio.net/2015/05/se-radio-episode-226-eric-evans-on-domain-driven-design-at-10-years/

Slide 42

Slide 42 text

IBM Cloud / February 9, 2018 / © 2018 IBM Corporation Strategic Design

Slide 43

Slide 43 text

Bounded contexts allow different models to be used within different domain contexts IBM Cloud / February 9, 2018 / © 2018 IBM Corporation rectangles by Dean Hochman, on Flickr (CC BY 2.0).

Slide 44

Slide 44 text

Each bounded context should have its own data layer, and should not directly access a data layer belonging to a different bounded context IBM Cloud / February 9, 2018 / © 2018 IBM Corporation Hexagons by Henry Burrows, on Flickr (CC BY-SA 2.0).

Slide 45

Slide 45 text

A data layer may be a database, or it can be a data system consisting of multiple databases— sometimes called polyglot persistence IBM Cloud / February 9, 2018 / © 2018 IBM Corporation FLOWERS Mixed Boquet by kazandrew, on Flickr (CC BY-SA 2.0).

Slide 46

Slide 46 text

Each bounded context may be represented as a microservice or a cluster of microservices IBM Cloud / February 9, 2018 / © 2018 IBM Corporation Rainforest Biome by BMiz, on Flickr .

Slide 47

Slide 47 text

IBM Cloud / February 9, 2018 / © 2018 IBM Corporation Catalog Document Database Key/Value Store Graph Database Full Text Search Shopping Cart Document Database Key/Value Store Orders Relational Database Big Data Analytics

Slide 48

Slide 48 text

IBM Cloud / February 9, 2018 / © 2018 IBM Corporation Alternative Architectures

Slide 49

Slide 49 text

Rather than update an entity in place, Command Query Responsibility Segregation (CQRS) provides separate read and write models IBM Cloud / February 9, 2018 / © 2018 IBM Corporation rectangles-10 by Karen Cropper, on Flickr (CC BY 2.0).

Slide 50

Slide 50 text

IBM Cloud / February 9, 2018 / © 2018 IBM Corporation Domain Layer Read Model «interface» OrderQueryHandler + findOrderById(id:int) : OrderDetails + recentOrders([limit:int]) : OrderSummary[0..*] Write Model OrderDetails + getId() : int + getCustomer() : Customer + getDate() : Date + getLineItems() : LineItem[1..*] + getTotal() : Money «interface» OrderCommandHandler + handle(command:CreateOrder) + handle(command:AddLineItem) CreateOrder - customer : Customer - date : Date - lineItems : LineItem[1..*] OrderSummary + getId() : int + getDate() : Date + getTotal() : Money AddLineItem - orderId : int - lineItem : LineItem

Slide 51

Slide 51 text

Event sourcing is an architecture in which application state is computed from a sequence of events IBM Cloud / February 9, 2018 / © 2018 IBM Corporation Rusty Chain by veggiefrog, on Flickr (CC BY 2.0).

Slide 52

Slide 52 text

IBM Cloud Data Services IBM Cloud / February 9, 2018 / © 2018 IBM Corporation

Slide 53

Slide 53 text

Thank you IBM Cloud / February 9, 2018 / © 2018 IBM Corporation Bradley Holt Developer Advocate Senior Software Engineer — ibm.com

Slide 54

Slide 54 text

IBM Cloud / February 9, 2018 / © 2018 IBM Corporation