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
モジュールの深さについて / depth of module
Search
nakabonne
January 28, 2019
Technology
0
140
モジュールの深さについて / depth of module
http://nakawatch.hatenablog.com/entry/module-depth
nakabonne
January 28, 2019
Tweet
Share
More Decks by nakabonne
See All by nakabonne
Write an embedded time-series database in Go
nakabonne
1
610
Want to quickly put dbg! into external crates?
nakabonne
0
31
Web API × Clean Architecture / CleanArchitecture Go
nakabonne
3
18k
Other Decks in Technology
See All in Technology
Oracle Cloud Infrastructureデータベース・クラウド:各バージョンのサポート期間
oracle4engineer
PRO
28
13k
マルチプロダクトな開発組織で 「開発生産性」に向き合うために試みたこと / Improving Multi-Product Dev Productivity
sugamasao
1
310
RubyのWebアプリケーションを50倍速くする方法 / How to Make a Ruby Web Application 50 Times Faster
hogelog
3
950
Platform Engineering for Software Developers and Architects
syntasso
1
520
Terraform Stacks入門 #HashiTalks
msato
0
360
Amazon CloudWatch Network Monitor のススメ
yuki_ink
1
210
TypeScriptの次なる大進化なるか!? 条件型を返り値とする関数の型推論
uhyo
2
1.7k
Introduction to Works of ML Engineer in LY Corporation
lycorp_recruit_jp
0
140
アジャイルチームがらしさを発揮するための目標づくり / Making the goal and enabling the team
kakehashi
3
140
DynamoDB でスロットリングが発生したとき/when_throttling_occurs_in_dynamodb_short
emiki
0
250
マルチモーダル / AI Agent / LLMOps 3つの技術トレンドで理解するLLMの今後の展望
hirosatogamo
37
12k
OCI Network Firewall 概要
oracle4engineer
PRO
0
4.2k
Featured
See All Featured
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
250
21k
Learning to Love Humans: Emotional Interface Design
aarron
273
40k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
4
370
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
169
50k
Typedesign – Prime Four
hannesfritz
40
2.4k
It's Worth the Effort
3n
183
27k
Happy Clients
brianwarren
98
6.7k
The MySQL Ecosystem @ GitHub 2015
samlambert
250
12k
Large-scale JavaScript Application Architecture
addyosmani
510
110k
5 minutes of I Can Smell Your CMS
philhawksworth
202
19k
Building Better People: How to give real-time feedback that sticks.
wjessup
364
19k
Code Review Best Practice
trishagee
64
17k
Transcript
Ϟδϡʔϧͷਂ͞ʹ͍ͭͯ CAEC MeetUP #4
Me • தඌ ྋ (@nakabonne) • தԝେֶֶ෦3 • AWAϚΠΫϩαʔϏε •
Go, Envoy, etc…
My tasks https://www.redhat.com/cms/managed-files/service-mesh-1680.png
My tasks https://github.com/DataDog/dd-py-tracing-workshop
Agenda • ྑ͍Ϟδϡʔϧͱ • deep moduleͱ
ྑ͍Ϟδϡʔϧͱ
খ͍͞Ϟδϡʔϧʁ
–The Unix Philosophy “Small is beautiful”
ԿނϞδϡʔϧΛ࡞Δͷ͔
ؔ࿈ੑͷߴ͍ཁૉ͕ू·Δ →࣮ͷෳࡶ͞ΛԼ͛Δ
Open a file in Java FileInputStream fileStream = new FileInputStream(fileName);
BufferedInputStream bufferedStream = new BufferedInputStream(fileStream); ObjectInputStream objectStream = new ObjectInputStream(bufferedStream);
Open a file in Java FileInputStream fileStream = new FileInputStream(fileName);
BufferedInputStream bufferedStream = new BufferedInputStream(fileStream); ObjectInputStream objectStream = new ObjectInputStream(bufferedStream); ॳาతͳI/O
Open a file in Java FileInputStream fileStream = new FileInputStream(fileName);
BufferedInputStream bufferedStream = new BufferedInputStream(fileStream); ObjectInputStream objectStream = new ObjectInputStream(bufferedStream); όοϑΝϦϯά
Open a file in Java FileInputStream fileStream = new FileInputStream(fileName);
BufferedInputStream bufferedStream = new BufferedInputStream(fileStream); ObjectInputStream objectStream = new ObjectInputStream(bufferedStream); read/write
࣮ͷෳࡶ͕͞࿙ΕͯΔ…
• খ͍͞ͱ͍͏͜ͱɺ࣋ͬͯΔใྔ͕গͳ͍ • ࣋ͬͯΔใྔ͕গͳ͍ͱɺ࣮ͷෳࡶ͕͞࿙ Ε͍͢ • ࣮ͷෳࡶ͕͞࿙Ε͍ͯΔͱɺ࣮มߋ͕पΓ ʹӨڹΛ༩͑͘͢ͳΔ
খ͞͞Λҙࣝ͗͢͠Δ
খ͞͞Λҙࣝ͗͢͠Δ
ߴڽूʁૄ݁߹ʁ
ߴڽूʁૄ݁߹ʁ
ߴڽूʁૄ݁߹ʁ ྑ͍ΠϯλʔϑΣʔε͕ඞཁ
ྑ͍ΠϯλʔϑΣʔεͱ
Bad interface
Bad interface
Bad interface
͔͠͠ιϑτΣΞมߋ͞ΕΔ →͜ͷໃ६ͷதͰ่Εͳ͍͜ͱ͕ٻΊΒΕΔ
Good interface ෆมʢՃҎ֎ͷมߋΛڐ͞ͳ͍ʣ
And
͍͋͘͢Δ͖
–Rich Hickey “Easy is relative”
Կ͕ศར͔ϢʔβʔʹΑΔ
Use case Edge case General case
Use case Edge case General case
Ұൠతͳέʔεʹߜͬͯ ͍͢͞Λٻ͢Δ
ෳࡶԽͷཧ༝ FileInputStream fileStream = new FileInputStream(fileName); BufferedInputStream bufferedStream = new
BufferedInputStream(fileStream); ObjectInputStream objectStream = new ObjectInputStream(bufferedStream); όοϑΝϦϯά͠ͳ͍ͱ͍͏ ΤοδέʔεΛڐ༰͍ͯ͠Δ
Good module ؔ࿈ੑͷߴ͍ͨ͘͞ΜͷཁૉΛӅ࣋ͪ͠ɺ ҰൠతͳέʔεͰ͍͘͢ෆมͳΠϯλʔ ϑΣʔεʹΑͬͯڧྗͳػೳΛఏڙ͢Δ
ߟ͑Δ͜ͱଟ͗͢ʂ
ຊ
deep module
A Philosophy of Software Design • ஶऀελϯϑΥʔυେֶ John Ousterhoutڭत •
ઐࢄγεςϜOS ͳͲଟذʹΔ
deep module γϯϓϧͳΠϯλʔϑΣʔεͰ ڧྗͳػೳΛఏڙ͢Δ
deep vs shallow modules
deep vs shallow modules
ΠϯλʔϑΣʔεͷෳࡶ͞ίετͰ ػೳͷڧྗ͞རӹ
ࢹ • ػೳڧྗ͚ͩͲɺͦΕҎ্ʹΠϯλʔ ϑΣʔε͕ෳࡶʹͳͬͯͳ͍͔ʁ • ΠϯλʔϑΣʔε؆୯͚ͩͲɺػೳ ශऑͰͳ͍͔ʁ
ྫɿUnix ϑΝΠϧI/O • open() • read() • write() • close()
• lseek() ←ෆม
Χʔωϧ ϢʔβΞϓϦέʔγϣϯΛ҆ఆͯ͠ ಈ࡞ͤ͞ΔͨΊʹઃܭ͞Ε͍ͯΔ →ࢀߟʹͳΔ
·ͱΊ
·ͱΊ • ྑ͍Ϟδϡʔϧͱʮؔ࿈ੑͷߴ͍ͨ͘͞ΜͷཁૉΛӅ࣋ͪ͠ɺҰൠత ͳέʔεͰ͍͘͢ෆมͳΠϯλʔϑΣʔεʹΑͬͯڧྗͳػೳΛఏ ڙ͢Δͷʯ • ࣮ݱ͢ΔͨΊʹʮϞδϡʔϧͷਂ͞ʯΛҙࣝ͢Δ • ͋͘·ͰҰͭͷߟ͑ํͰ͋ΔͨΊɺΣϧΧϜ
͋Γ͕ͱ͏͍͟͝·ͨ͠