Slide 1

Slide 1 text

How to please everyone

Slide 2

Slide 2 text

How to please everyone or random thoughts about library design

Slide 3

Slide 3 text

What we will talk about

Slide 4

Slide 4 text

What we will talk about • Design your library API

Slide 5

Slide 5 text

What we will talk about • Design your library API • Make it clear, effective, predictable and transparent

Slide 6

Slide 6 text

What we will talk about • Design your library API • Make it clear, effective, predictable and transparent • Choose between alternative implementations

Slide 7

Slide 7 text

What we will talk about • Design your library API • Make it clear, effective, predictable and transparent • Choose between alternative implementations • Assess your choices

Slide 8

Slide 8 text

About me

Slide 9

Slide 9 text

About me

Slide 10

Slide 10 text

About me

Slide 11

Slide 11 text

About me

Slide 12

Slide 12 text

Disclaimer This talk is based on personal experience

Slide 13

Slide 13 text

Your users

Slide 14

Slide 14 text

Your users •Regular users

Slide 15

Slide 15 text

Your users •Regular users •Advanced users

Slide 16

Slide 16 text

Your users •Regular users •Advanced users •Experts

Slide 17

Slide 17 text

Your users •Regular users •Advanced users •Experts

Slide 18

Slide 18 text

Your users •Regular users •Advanced users •Experts

Slide 19

Slide 19 text

Your users •Regular users •Advanced users •Experts

Slide 20

Slide 20 text

Regular users

Slide 21

Slide 21 text

Regular users

Slide 22

Slide 22 text

Regular users

Slide 23

Slide 23 text

Regular users

Slide 24

Slide 24 text

No content

Slide 25

Slide 25 text

No content

Slide 26

Slide 26 text

Example

Slide 27

Slide 27 text

Example

Slide 28

Slide 28 text

Example github.com/storozhukBM/verifier

Slide 29

Slide 29 text

Example github.com/storozhukBM/verifier

Slide 30

Slide 30 text

copy&paste friendliness • Meaningful method names

Slide 31

Slide 31 text

copy&paste friendliness • Meaningful method names • Zero configuration

Slide 32

Slide 32 text

copy&paste friendliness • Meaningful method names • Zero configuration • Familiar patterns

Slide 33

Slide 33 text

copy&paste friendliness • Meaningful method names • Zero configuration • Familiar patterns • Testability

Slide 34

Slide 34 text

copy&paste friendliness • Meaningful method names • Zero configuration • Familiar patterns • Testability • No state management

Slide 35

Slide 35 text

Examples github.com/pkg/errors

Slide 36

Slide 36 text

Examples github.com/robfig/cron

Slide 37

Slide 37 text

Examples github.com/robfig/cron

Slide 38

Slide 38 text

Examples github.com/robfig/cron

Slide 39

Slide 39 text

Examples github.com/robfig/cron

Slide 40

Slide 40 text

Examples github.com/robfig/cron

Slide 41

Slide 41 text

Advanced users

Slide 42

Slide 42 text

No content

Slide 43

Slide 43 text

Advanced users

Slide 44

Slide 44 text

Pragmatism friendliness • Meaningful method names • Zero configuration • Familiar patterns • Testability • No state management

Slide 45

Slide 45 text

Pragmatism friendliness • Meaningful method names • Zero configuration Reasonable defaults • Familiar patterns • Testability • No state management

Slide 46

Slide 46 text

Pragmatism friendliness • Meaningful method names • Zero configuration Reasonable defaults • Familiar patterns • Testability Introspection • No state management

Slide 47

Slide 47 text

Pragmatism friendliness • Meaningful method names • Zero configuration Reasonable defaults • Familiar patterns • Testability Introspection • No state management (by default)

Slide 48

Slide 48 text

Optional configuration

Slide 49

Slide 49 text

Optional configuration github.com/tidwall/buntdb

Slide 50

Slide 50 text

Optional configuration github.com/tidwall/buntdb

Slide 51

Slide 51 text

Optional configuration github.com/valyala/fasthttp

Slide 52

Slide 52 text

Introspection

Slide 53

Slide 53 text

Introspection github.com/valyala/fasthttp

Slide 54

Slide 54 text

Introspection github.com/valyala/fasthttp

Slide 55

Slide 55 text

Introspection github.com/resilience4j/resilience4j

Slide 56

Slide 56 text

Introspection github.com/resilience4j/resilience4j

Slide 57

Slide 57 text

Introspection github.com/resilience4j/resilience4j

Slide 58

Slide 58 text

Introspection github.com/resilience4j/resilience4j

Slide 59

Slide 59 text

Introspection github.com/resilience4j/resilience4j

Slide 60

Slide 60 text

Experts

Slide 61

Slide 61 text

Experts

Slide 62

Slide 62 text

Experts

Slide 63

Slide 63 text

Expert friendliness • allocations controll

Slide 64

Slide 64 text

Expert friendliness • allocations controll • zero-cost abstractions

Slide 65

Slide 65 text

Expert friendliness • allocations controll • zero-cost abstractions • cost modelling

Slide 66

Slide 66 text

Expert friendliness • allocations controll • zero-cost abstractions • cost modelling • paradigm agnostics

Slide 67

Slide 67 text

Expert friendliness • allocations controll • zero-cost abstractions • cost modelling • paradigm agnostics • multi-level API

Slide 68

Slide 68 text

Tools •Profiler

Slide 69

Slide 69 text

Tools •Profiler •Tracer

Slide 70

Slide 70 text

Tools •Profiler •Tracer •Throughput benchmarks

Slide 71

Slide 71 text

Tools •Profiler •Tracer •Throughput benchmarks •Latency benchmarks

Slide 72

Slide 72 text

Tools •Profiler •Tracer •Throughput benchmarks •Latency benchmarks •Allocations profiling

Slide 73

Slide 73 text

Allocations control github.com/storozhukBM/verifier

Slide 74

Slide 74 text

Allocations control github.com/storozhukBM/verifier

Slide 75

Slide 75 text

Allocations control github.com/storozhukBM/verifier

Slide 76

Slide 76 text

Allocations control github.com/storozhukBM/verifier

Slide 77

Slide 77 text

Zero-cost abstractions “not pay for what you don't use”

Slide 78

Slide 78 text

Zero-cost abstractions github.com/resilience4j/resilience4j

Slide 79

Slide 79 text

Zero-cost abstractions github.com/resilience4j/resilience4j

Slide 80

Slide 80 text

Cost modelling

Slide 81

Slide 81 text

No content

Slide 82

Slide 82 text

No content

Slide 83

Slide 83 text

No content

Slide 84

Slide 84 text

No content

Slide 85

Slide 85 text

Paradigm agnostics

Slide 86

Slide 86 text

Paradigm agnostics

Slide 87

Slide 87 text

Is it even possible? •Regular users •Advanced users •Experts

Slide 88

Slide 88 text

No content

Slide 89

Slide 89 text

No content

Slide 90

Slide 90 text

Multi-level API

Slide 91

Slide 91 text

Multi-level API

Slide 92

Slide 92 text

Multi-level API

Slide 93

Slide 93 text

Multi-level API

Slide 94

Slide 94 text

Multi-level API

Slide 95

Slide 95 text

One more thing

Slide 96

Slide 96 text

No content

Slide 97

Slide 97 text

One more thing

Slide 98

Slide 98 text

Backward compatibility

Slide 99

Slide 99 text

API State Clear Stateless Predictable Transparent Effective Summary

Slide 100

Slide 100 text

FIN