Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
How to design a library
Search
Iskander (Alex) Sharipov
April 25, 2020
Programming
0
280
How to design a library
Богдан Сторожук.
Iskander (Alex) Sharipov
April 25, 2020
Tweet
Share
More Decks by Iskander (Alex) Sharipov
See All by Iskander (Alex) Sharipov
Go gamedev: XM music
quasilyte
0
68
Zero alloc pathfinding
quasilyte
0
370
Mycelium
quasilyte
0
36
Roboden game pitch
quasilyte
0
140
Ebitengine Ecosystem Overview
quasilyte
1
660
Go gamedev patterns
quasilyte
0
390
profile-guided code analysis
quasilyte
0
300
Go inlining
quasilyte
0
98
KPHP FFI
quasilyte
0
400
Other Decks in Programming
See All in Programming
What’s New in Compose Multiplatform - A Live Tour (droidcon London 2024)
zsmb
1
480
.NET のための通信フレームワーク MagicOnion 入門 / Introduction to MagicOnion
mayuki
1
1.7k
レガシーシステムにどう立ち向かうか 複雑さと理想と現実/vs-legacy
suzukihoge
14
2.2k
最新TCAキャッチアップ
0si43
0
190
「今のプロジェクトいろいろ大変なんですよ、app/services とかもあって……」/After Kaigi on Rails 2024 LT Night
junk0612
5
2.2k
エンジニアとして関わる要件と仕様(公開用)
murabayashi
0
300
役立つログに取り組もう
irof
28
9.6k
聞き手から登壇者へ: RubyKaigi2024 LTでの初挑戦が 教えてくれた、可能性の星
mikik0
1
130
TypeScriptでライブラリとの依存を限定的にする方法
tutinoko
3
690
EMになってからチームの成果を最大化するために取り組んだこと/ Maximize team performance as EM
nashiusagi
0
100
Amazon Qを使ってIaCを触ろう!
maruto
0
410
Creating a Free Video Ad Network on the Edge
mizoguchicoji
0
120
Featured
See All Featured
Git: the NoSQL Database
bkeepers
PRO
427
64k
Writing Fast Ruby
sferik
627
61k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
131
33k
Docker and Python
trallard
40
3.1k
Done Done
chrislema
181
16k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
364
24k
Facilitating Awesome Meetings
lara
50
6.1k
Designing for Performance
lara
604
68k
Large-scale JavaScript Application Architecture
addyosmani
510
110k
Build your cross-platform service in a week with App Engine
jlugia
229
18k
Faster Mobile Websites
deanohume
305
30k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
665
120k
Transcript
How to please everyone
How to please everyone or random thoughts about library design
What we will talk about
What we will talk about • Design your library API
What we will talk about • Design your library API
• Make it clear, effective, predictable and transparent
What we will talk about • Design your library API
• Make it clear, effective, predictable and transparent • Choose between alternative implementations
What we will talk about • Design your library API
• Make it clear, effective, predictable and transparent • Choose between alternative implementations • Assess your choices
About me
About me
About me
About me
Disclaimer This talk is based on personal experience
Your users
Your users •Regular users
Your users •Regular users •Advanced users
Your users •Regular users •Advanced users •Experts
Your users •Regular users •Advanced users •Experts
Your users •Regular users •Advanced users •Experts
Your users •Regular users •Advanced users •Experts
Regular users
Regular users
Regular users
Regular users
None
None
Example
Example
Example github.com/storozhukBM/verifier
Example github.com/storozhukBM/verifier
copy&paste friendliness • Meaningful method names
copy&paste friendliness • Meaningful method names • Zero configuration
copy&paste friendliness • Meaningful method names • Zero configuration •
Familiar patterns
copy&paste friendliness • Meaningful method names • Zero configuration •
Familiar patterns • Testability
copy&paste friendliness • Meaningful method names • Zero configuration •
Familiar patterns • Testability • No state management
Examples github.com/pkg/errors
Examples github.com/robfig/cron
Examples github.com/robfig/cron
Examples github.com/robfig/cron
Examples github.com/robfig/cron
Examples github.com/robfig/cron
Advanced users
None
Advanced users
Pragmatism friendliness • Meaningful method names • Zero configuration •
Familiar patterns • Testability • No state management
Pragmatism friendliness • Meaningful method names • Zero configuration Reasonable
defaults • Familiar patterns • Testability • No state management
Pragmatism friendliness • Meaningful method names • Zero configuration Reasonable
defaults • Familiar patterns • Testability Introspection • No state management
Pragmatism friendliness • Meaningful method names • Zero configuration Reasonable
defaults • Familiar patterns • Testability Introspection • No state management (by default)
Optional configuration
Optional configuration github.com/tidwall/buntdb
Optional configuration github.com/tidwall/buntdb
Optional configuration github.com/valyala/fasthttp
Introspection
Introspection github.com/valyala/fasthttp
Introspection github.com/valyala/fasthttp
Introspection github.com/resilience4j/resilience4j
Introspection github.com/resilience4j/resilience4j
Introspection github.com/resilience4j/resilience4j
Introspection github.com/resilience4j/resilience4j
Introspection github.com/resilience4j/resilience4j
Experts
Experts
Experts
Expert friendliness • allocations controll
Expert friendliness • allocations controll • zero-cost abstractions
Expert friendliness • allocations controll • zero-cost abstractions • cost
modelling
Expert friendliness • allocations controll • zero-cost abstractions • cost
modelling • paradigm agnostics
Expert friendliness • allocations controll • zero-cost abstractions • cost
modelling • paradigm agnostics • multi-level API
Tools •Profiler
Tools •Profiler •Tracer
Tools •Profiler •Tracer •Throughput benchmarks
Tools •Profiler •Tracer •Throughput benchmarks •Latency benchmarks
Tools •Profiler •Tracer •Throughput benchmarks •Latency benchmarks •Allocations profiling
Allocations control github.com/storozhukBM/verifier
Allocations control github.com/storozhukBM/verifier
Allocations control github.com/storozhukBM/verifier
Allocations control github.com/storozhukBM/verifier
Zero-cost abstractions “not pay for what you don't use”
Zero-cost abstractions github.com/resilience4j/resilience4j
Zero-cost abstractions github.com/resilience4j/resilience4j
Cost modelling
None
None
None
None
Paradigm agnostics
Paradigm agnostics
Is it even possible? •Regular users •Advanced users •Experts
None
None
Multi-level API
Multi-level API
Multi-level API
Multi-level API
Multi-level API
One more thing
None
One more thing
Backward compatibility
API State Clear Stateless Predictable Transparent Effective Summary
FIN