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
NW-JAWS #14 re:Invent 2024(予選落ち含)で 発表された推しアップデートについて
nagisa53
0
270
Opcodeを読んでいたら何故かphp-srcを読んでいた話
murashotaro
0
250
オプトインカメラ:UWB測位を応用したオプトイン型のカメラ計測
matthewlujp
0
180
バクラクのドキュメント解析技術と実データにおける課題 / layerx-ccc-winter-2024
shimacos
2
1.1k
OpenAIの蒸留機能(Model Distillation)を使用して運用中のLLMのコストを削減する取り組み
pharma_x_tech
4
560
多領域インシデントマネジメントへの挑戦:ハードウェアとソフトウェアの融合が生む課題/Challenge to multidisciplinary incident management: Issues created by the fusion of hardware and software
bitkey
PRO
2
110
サイバー攻撃を想定したセキュリティガイドライン 策定とASM及びCNAPPの活用方法
syoshie
3
1.3k
LINEスキマニにおけるフロントエンド開発
lycorptech_jp
PRO
0
330
20241220_S3 tablesの使い方を検証してみた
handy
4
580
ゼロから創る横断SREチーム 挑戦と進化の軌跡
rvirus0817
2
270
統計データで2024年の クラウド・インフラ動向を眺める
ysknsid25
2
850
KubeCon NA 2024 Recap / Running WebAssembly (Wasm) Workloads Side-by-Side with Container Workloads
z63d
1
250
Featured
See All Featured
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
29
2.3k
Rails Girls Zürich Keynote
gr2m
94
13k
RailsConf 2023
tenderlove
29
940
Imperfection Machines: The Place of Print at Facebook
scottboms
266
13k
Why You Should Never Use an ORM
jnunemaker
PRO
54
9.1k
Embracing the Ebb and Flow
colly
84
4.5k
Fontdeck: Realign not Redesign
paulrobertlloyd
82
5.3k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
251
21k
Scaling GitHub
holman
458
140k
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
656
59k
A Modern Web Designer's Workflow
chriscoyier
693
190k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
0
98
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() ←ෆม
Χʔωϧ ϢʔβΞϓϦέʔγϣϯΛ҆ఆͯ͠ ಈ࡞ͤ͞ΔͨΊʹઃܭ͞Ε͍ͯΔ →ࢀߟʹͳΔ
·ͱΊ
·ͱΊ • ྑ͍Ϟδϡʔϧͱʮؔ࿈ੑͷߴ͍ͨ͘͞ΜͷཁૉΛӅ࣋ͪ͠ɺҰൠత ͳέʔεͰ͍͘͢ෆมͳΠϯλʔϑΣʔεʹΑͬͯڧྗͳػೳΛఏ ڙ͢Δͷʯ • ࣮ݱ͢ΔͨΊʹʮϞδϡʔϧͷਂ͞ʯΛҙࣝ͢Δ • ͋͘·ͰҰͭͷߟ͑ํͰ͋ΔͨΊɺΣϧΧϜ
͋Γ͕ͱ͏͍͟͝·ͨ͠