Slide 1

Slide 1 text

FloorPlan: Visualize databases’ evolution www.juliozynger.com

Slide 2

Slide 2 text

SoundCloud www.juliozynger.com ● 200+ million tracks → world’s largest open audio platform ● Over 25 million creators ● Available in 190 countries ● 90%+ of usage comes from mobile devices

Slide 3

Slide 3 text

SoundCloud www.juliozynger.com ● Started as Rails application ● Microservice extraction ● Dozens of engineers, hundreds of services ● Polyglot development and tooling

Slide 4

Slide 4 text

SoundCloud www.juliozynger.com ● ~20 engineers ● ~60 merged PRs per week ● ~250 modules, ~8000 tests, ~15 databases

Slide 5

Slide 5 text

SoundCloud Bare SQL www.juliozynger.com

Slide 6

Slide 6 text

SoundCloud www.juliozynger.com Bare SQL Propeller Lean API Type Safety Observability, etc.

Slide 7

Slide 7 text

SoundCloud www.juliozynger.com SQLDelight Code generation SQL / Java,Kt separation Multiplatform Bare SQL Propeller Lean API Type Safety Observability, etc.

Slide 8

Slide 8 text

SoundCloud www.juliozynger.com Room Google’s solution Onboardable Well-documented SQLDelight Code generation SQL / Java,Kt separation Multiplatform Bare SQL Propeller Lean API Type Safety Observability, etc.

Slide 9

Slide 9 text

www.juliozynger.com

Slide 10

Slide 10 text

www.juliozynger.com Documentation

Slide 11

Slide 11 text

www.juliozynger.com

Slide 12

Slide 12 text

www.juliozynger.com

Slide 13

Slide 13 text

www.juliozynger.com

Slide 14

Slide 14 text

www.juliozynger.com

Slide 15

Slide 15 text

A document shouldn’t try to do what the code already does well. www.juliozynger.com “ ― Eric Evans, Domain-Driven Design: Tackling Complexity in the Heart of Software

Slide 16

Slide 16 text

www.juliozynger.com ?

Slide 17

Slide 17 text

www.juliozynger.com FloorPlan

Slide 18

Slide 18 text

Architecture www.juliozynger.com Consumer Schema DBML

Slide 19

Slide 19 text

Architecture www.juliozynger.com Consumer Schema DBML impl

Slide 20

Slide 20 text

www.juliozynger.com

Slide 21

Slide 21 text

www.juliozynger.com

Slide 22

Slide 22 text

Architecture www.juliozynger.com Consumer Schema DBML Room Consumer

Slide 23

Slide 23 text

Architecture www.juliozynger.com Consumer Schema DBML SQLite Consumer

Slide 24

Slide 24 text

DBML (dbml.org) www.juliozynger.com ● Open-source DSL language ● Define and document DB schemas ● Designed to be simple, consistent and highly-readable

Slide 25

Slide 25 text

DBML (dbml.org) www.juliozynger.com Table users { id integer [pk] username varchar role varchar } Table posts { id integer [pk] title varchar body text [note: 'Content of the post'] user_id integer } Ref: posts.user_id > users.id

Slide 26

Slide 26 text

Rendering: GraphViz www.juliozynger.com ● Open-source graph visualization software ● Java bindings through graphviz-java val graph: Graph = mutGraph() graph.addNodes(tables.map { it.toNode() }) graph.addLinks(references.map { it.toLink() }) g.render(Format.SVG)

Slide 27

Slide 27 text

www.juliozynger.com Interactivity through metadata

Slide 28

Slide 28 text

Workflow www.juliozynger.com

Slide 29

Slide 29 text

www.juliozynger.com CLI

Slide 30

Slide 30 text

www.juliozynger.com Gradle Plugin floorPlan { schemaLocation = "$projectDir/schemas" outputLocation = "$projectDir/floorplan-output" outputFormat { svg { enabled = true } } }

Slide 31

Slide 31 text

www.juliozynger.com Gradle Plugin apply plugin: 'kotlin-kapt' apply plugin: 'com.juliozynger.floorplan' kapt { arg("room.schemaLocation", "$projectDir/schemas") ... } floorPlan { schemaLocation = "$projectDir/schemas" ... } dependencies { implementation Libs.room_runtime ... } room-support.gradle apply from: "$rootProject.projectDir/android-library.gradle" apply from: "$rootProject.projectDir/room-support.gradle" dependencies { implementation Libs.dagger implementation Libs.appcompat testImplementation Libs.junit ... } some-module/build.gradle

Slide 32

Slide 32 text

www.juliozynger.com IDE Plugin

Slide 33

Slide 33 text

www.juliozynger.com IDE Plugin

Slide 34

Slide 34 text

www.juliozynger.com SoundCloud-Android ├─ app ├─ docs ├─ modules │ ├─ discovery │ │ ├─ src │ │ ├─ schemas │ │ └─ floorplan-output │ ├─ player │ │ ├─ src │ │ ├─ schemas │ │ └─ floorplan-output │ ├─ upload │ │ ├─ src │ │ ├─ schemas │ │ └─ floorplan-output └─ ... Serving SoundCloud-Android ├─ app ├─ docs │ └─ databases │ ├─ discovery │ ├─ player │ └─ upload │ ├─ 1.svg │ ├─ 2.svg │ └─ ... ├─ modules │ └─ ... └─ mkdocs.yml >

Slide 35

Slide 35 text

www.juliozynger.com

Slide 36

Slide 36 text

www.juliozynger.com Code Review

Slide 37

Slide 37 text

www.juliozynger.com Code Review

Slide 38

Slide 38 text

Wrap-up www.juliozynger.com

Slide 39

Slide 39 text

www.juliozynger.com Wrap-up ● Source code is source for docs

Slide 40

Slide 40 text

www.juliozynger.com Wrap-up ● Source code is source for docs ● No disruption through full automation

Slide 41

Slide 41 text

www.juliozynger.com Wrap-up ● Source code is source for docs ● No disruption through full automation ● Value generation in each step of the pipeline

Slide 42

Slide 42 text

www.juliozynger.com Wrap-up ● Source code is source for docs ● No disruption through full automation ● Value generation in each step of the pipeline ● Workflow augmentation

Slide 43

Slide 43 text

www.juliozynger.com Wrap-up ● Source code is source for docs ● No disruption through full automation ● Value generation in each step of the pipeline ● Workflow augmentation ● Enable potential extension

Slide 44

Slide 44 text

www.juliozynger.com Wrap-up ● Source code is source for docs ● No disruption through full automation ● Value generation in each step of the pipeline ● Workflow augmentation ● Enable potential extension ● Accessibility through environment agnostic tooling

Slide 45

Slide 45 text

www.juliozynger.com Wrap-up ● Source code is source for docs ● No disruption through full automation ● Value generation in each step of the pipeline ● Workflow augmentation ● Enable potential extension ● Accessibility through environment agnostic tooling ● Inter business department involvement

Slide 46

Slide 46 text

www.juliozynger.com Wrap-up julioz.github.io/FloorPlan

Slide 47

Slide 47 text

Thanks! @juliozynger soundcloud.com/jobs