The Impedance Mismatch is Our Fault Stuart Halloway Datomic Team, - - PowerPoint PPT Presentation

the impedance mismatch is our fault
SMART_READER_LITE
LIVE PREVIEW

The Impedance Mismatch is Our Fault Stuart Halloway Datomic Team, - - PowerPoint PPT Presentation

The Impedance Mismatch is Our Fault Stuart Halloway Datomic Team, Clojure/core, Relevance 1 All information in the database is to be represented in only one way, namely by values in column positions within rows of tables.


slide-1
SLIDE 1

The Impedance Mismatch is Our Fault

Stuart Halloway

Datomic Team, Clojure/core, Relevance

1

slide-2
SLIDE 2

All information in the database is to be represented in

  • nly one way,

namely by values in column positions within rows of tables.

http://en.wikipedia.org/wiki/Codd%27s_12_rules

2

slide-3
SLIDE 3

OOP to me means only messaging, local retention and protection and hiding

  • f state-process, and

extreme late-binding of all things. It can be done in Smalltalk and in LISP. There are possibly other systems in which this is possible, but I'm not aware of them.

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

3

slide-4
SLIDE 4

“...Essentially the ORM can handle about 80-90% of the mapping problems...”

http://java.dzone.com/articles/martin-fowler-orm-hate

4

slide-5
SLIDE 5

“...I think NoSQL is technology to be taken very seriously....”

http://java.dzone.com/articles/martin-fowler-orm-hate

5

slide-6
SLIDE 6

“...Not all problems are technically suitable for a NoSQL database...”

http://java.dzone.com/articles/martin-fowler-orm-hate

6

slide-7
SLIDE 7

“...early successes yield a commitment to use O/R-M...”

http://blogs.tedneward.com/2006/06/26/The+Vietnam+Of+Computer+Science.aspx

7

slide-8
SLIDE 8

“...the Slippery Slope...”

http://blogs.tedneward.com/2006/06/26/The+Vietnam+Of+Computer+Science.aspx

8

slide-9
SLIDE 9

“...the Last Mile Problem...”

http://blogs.tedneward.com/2006/06/26/The+Vietnam+Of+Computer+Science.aspx

9

slide-10
SLIDE 10

Code Phrases for “I Give Up”

  • “use ORM for the 80% case”
  • “polyglot persistence”
  • “right tool for the job”
  • “use NoSQL where appropriate”
  • “hybrid approach”

10

slide-11
SLIDE 11

Don’t Give Up!

Mainstream OO and RDBMS approaches are hopelessly complected. If you simplify them, you will find the building blocks for a general-purpose approach to data

11

slide-12
SLIDE 12

OO RDBMS

processing

  • bject at a time

set at a time

structure

dictionaries rectangles

access

navigation query

location

  • ver here
  • ver there

12

slide-13
SLIDE 13

DRY vs. Rectangular

  • join table
  • person table
  • club table
  • id key in person table
  • person key in join table
  • club key in join table
  • id key in club table

“People can belong to multiple clubs”

13

slide-14
SLIDE 14

The “Over There” Problem

“the query can be decorated with spans that instruct the persistence layer to fetch related objects at the same time."

http://www.codeproject.com/Articles/20849/ORM-as-Vietnam-of-Computer-Science-A-Response

14

slide-15
SLIDE 15

The “Over There” Problem

http://stackoverflow.com/questions/404083/is-orm-still-the-vietnam-of-computer-science

"RoR and the ActiveRecord pattern have deservedly earned a reputation as dbms resource hogs for this reason. Optimized ActiveRecord design is more often than not suboptimal SQL design, because it encourages SQL statement decomposition."

15

slide-16
SLIDE 16

OO RDBMS

processing

  • bject at a time

set at a time

structure

dictionaries rectangles

access

navigation query

location

  • ver here
  • ver there

programmable?

no no

perception

coordinated coordinated

action

assist use of tx system

transactions

16

slide-17
SLIDE 17

Programmability of SQL?

http://imgs.xkcd.com/comics/exploits_of_a_mom.png

17

slide-18
SLIDE 18

// build generator for the new class String tname = tclas.getName(); ClassPool pool = ClassPool.getDefault(); CtClass clas = pool.makeClass(cname); clas.addInterface(pool.get("IAccess")); CtClass target = pool.get(tname); // add target object field to class CtField field = new CtField(target, "m_target", clas); clas.addField(field); // add public default constructor method to class CtConstructor cons = new CtConstructor(NO_ARGS, clas); cons.setBody(";"); clas.addConstructor(cons);

Programmability of Java?

http://www.ibm.com/developerworks/java/library/j-dyn0610/

18

slide-19
SLIDE 19

Coordinating Perception is Insane

  • I don’t slow down when you watch me
  • Records are immutable
  • Reality is cumulative
  • new time requires new space

19

slide-20
SLIDE 20

Transactions are awesome

20

slide-21
SLIDE 21

OO RDBMS Imagine!

processing

  • bject at a

time set at a time both

structure

dictionaries rectangles any

access

navigation query both

location

  • ver here
  • ver there

anywhere

programmable?

no no yes

perception

coordinated coordinated values

action

assist use of tx system

transactions any

21

slide-22
SLIDE 22

OO RDBMS Imagine!

processing

  • bject at a

time set at a time both

structure

dictionaries rectangles any

access

navigation query both

location

  • ver here
  • ver there

anywhere

programmable?

no no yes

perception

coordinated coordinated values

action

assist use of tx system

transactions any

22

slide-23
SLIDE 23

Rebuilding

23

slide-24
SLIDE 24

Imagine!

processing structure access location programmable? perception action

24

slide-25
SLIDE 25

Imagine!

processing structure access location programmable?

yes

perception action

Everything is made of data

25

slide-26
SLIDE 26

Imagine!

processing structure access location

anywhere

programmable?

yes

perception

values

action

Data is immutable

26

slide-27
SLIDE 27

Imagine!

processing structure access location

anywhere

programmable?

yes

perception

values

action

The fundamental unit of data is the datom: E / A / V / T

27

slide-28
SLIDE 28

Imagine!

processing structure

dictionary

access location

anywhere

programmable?

yes

perception

values

action

A set of datoms has a 100% mechanical transformation to a dictionary.

28

slide-29
SLIDE 29

Imagine!

processing structure

dictionary rectangle

access location

anywhere

programmable?

yes

perception

values

action

A set of datoms has a 100% mechanical transformation to rectangles.

29

slide-30
SLIDE 30

Imagine!

processing structure

dictionary rectangle columns

access location

anywhere

programmable?

yes

perception

values

action

A set of datoms has a 100% mechanical transformation to columns.

30

slide-31
SLIDE 31

Imagine!

processing structure

dictionary rectangle column graph

access location

anywhere

programmable?

yes

perception

values

action

A set of datoms has a 100% mechanical transformation to a graph.

31

slide-32
SLIDE 32

Imagine!

processing structure

dictionary rectangle column graph entity

access location

anywhere

programmable?

yes

perception

values

action

A set of datoms has a 100% mechanical transformation to an entity.

32

slide-33
SLIDE 33

Stop Abusing Documents

33

slide-34
SLIDE 34

Imagine!

processing structure

any

access

query

location

anywhere!!

programmable?

yes

perception

values!!

action

Datalog has power equivalent to the relational algebra

34

slide-35
SLIDE 35

Imagine!

processing

set at a time

structure

any

access

query

location

anywhere!!

programmable?

yes

perception

values!!

action

Datalog is set-at-a-time

35

slide-36
SLIDE 36

Imagine!

processing

set at a time, tuple at a time

structure

any

access

query

location

anywhere!!

programmable?

yes

perception

values!!

action

core.logic is tuple at a time

36

slide-37
SLIDE 37

Imagine!

processing

set or tuple at a time entity at a time

structure

any

access

query navigation

location

anywhere!!

programmable?

yes

perception

values!!!!

action

Entity provides generic, lazy traversal

37

slide-38
SLIDE 38

Imagine!

processing

any

structure

any

access

any

location

anywhere!!

programmable?

yes

perception

values!!!!

action

transactions

serialized transactions ACID and easy

38

slide-39
SLIDE 39

Imagine!

processing

any

structure

any

access

any

location

anywhere

programmable?

yes!!

perception

values!!!!!!

action

transactions transaction fns

transaction functions pure functions composable installed in db run anywhere

39

slide-40
SLIDE 40

Imagine!

processing

any

structure

any

access

any

location

anywhere

programmable?

yes!!

perception

values!!!!!!

action

txes, tx fns

bonus round

40

slide-41
SLIDE 41

Imagine!

processing

any

structure

any

access

any

location

anywhere

programmable?

yes!!

perception

values!!!!!!

action

txes, tx fns

bonus round time model

db.asOf(lastMonth)

41

slide-42
SLIDE 42

Imagine!

processing

any

structure

any

access

any

location

anywhere

programmable?

yes!!

perception

values!!!!!!

action

txes, tx fns

bonus round time model scale read and query horizontally

42

slide-43
SLIDE 43

Imagine!

processing

any

structure

any

access

any

location

anywhere

programmable?

yes!!

perception

values!!!!!!

action

txes, tx fns

bonus round time model scale read and query horizontally “what if” queries

db.with(newData)

43

slide-44
SLIDE 44

Imagine!

processing

any

structure

any

access

any

location

anywhere

programmable?

yes!!

perception

values!!!!!!

action

txes, tx fns

bonus round time model scale read and query horizontally “what if” queries multi-source queries

44

slide-45
SLIDE 45

Imagine!

processing

?

structure

?

access

?

location

anywhere

programmable?

?

perception

values

action

? ?? ?

you can play the home game! simplify program with values fill in your own answers

45

slide-46
SLIDE 46

"I think that if you if you're going to dump on something in the way many people do about ORMs, you have to state the alternative"

http://java.dzone.com/articles/martin-fowler-orm-hate

46

slide-47
SLIDE 47

Thanks!

@stuarthalloway

47