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
620
Want to quickly put dbg! into external crates?
nakabonne
0
32
Web API × Clean Architecture / CleanArchitecture Go
nakabonne
3
18k
Other Decks in Technology
See All in Technology
AWS re:Invent 2024で発表された コードを書く開発者向け機能について
maruto
0
180
成果を出しながら成長する、アウトプット駆動のキャッチアップ術 / Output-driven catch-up techniques to grow while producing results
aiandrox
0
180
Password-less Journey - パスキーへの移行を見据えたユーザーの準備 @ AXIES 2024
ritou
3
1.4k
大幅アップデートされたRagas v0.2をキャッチアップ
os1ma
2
520
Wvlet: A New Flow-Style Query Language For Functional Data Modeling and Interactive Data Analysis - Trino Summit 2024
xerial
1
110
プロダクト開発を加速させるためのQA文化の築き方 / How to build QA culture to accelerate product development
mii3king
1
260
非機能品質を作り込むための実践アーキテクチャ
knih
3
730
alecthomas/kong はいいぞ / kamakura.go#7
fujiwara3
1
300
Amazon VPC Lattice 最新アップデート紹介 - PrivateLink も似たようなアップデートあったけど違いとは
bigmuramura
0
190
どちらを使う?GitHub or Azure DevOps Ver. 24H2
kkamegawa
0
630
社内イベント管理システムを1週間でAKSからACAに移行した話し
shingo_kawahara
0
180
Wantedly での Datadog 活用事例
bgpat
1
410
Featured
See All Featured
Statistics for Hackers
jakevdp
796
220k
Embracing the Ebb and Flow
colly
84
4.5k
The Art of Programming - Codeland 2020
erikaheidi
53
13k
How To Stay Up To Date on Web Technology
chriscoyier
789
250k
Optimising Largest Contentful Paint
csswizardry
33
3k
Measuring & Analyzing Core Web Vitals
bluesmoon
4
170
How to Ace a Technical Interview
jacobian
276
23k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
44
6.9k
Side Projects
sachag
452
42k
Fashionably flexible responsive web design (full day workshop)
malarkey
405
65k
Unsuck your backbone
ammeep
669
57k
Designing Experiences People Love
moore
138
23k
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() ←ෆม
Χʔωϧ ϢʔβΞϓϦέʔγϣϯΛ҆ఆͯ͠ ಈ࡞ͤ͞ΔͨΊʹઃܭ͞Ε͍ͯΔ →ࢀߟʹͳΔ
·ͱΊ
·ͱΊ • ྑ͍Ϟδϡʔϧͱʮؔ࿈ੑͷߴ͍ͨ͘͞ΜͷཁૉΛӅ࣋ͪ͠ɺҰൠత ͳέʔεͰ͍͘͢ෆมͳΠϯλʔϑΣʔεʹΑͬͯڧྗͳػೳΛఏ ڙ͢Δͷʯ • ࣮ݱ͢ΔͨΊʹʮϞδϡʔϧͷਂ͞ʯΛҙࣝ͢Δ • ͋͘·ͰҰͭͷߟ͑ํͰ͋ΔͨΊɺΣϧΧϜ
͋Γ͕ͱ͏͍͟͝·ͨ͠