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
630
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
re:Invent 2024のふりかえり
beli68
0
110
[IBM TechXchange Dojo]Watson Discoveryとwatsonx.aiでRAGを実現!事例のご紹介+座学②
siyuanzh09
0
110
デジタルアイデンティティ技術 認可・ID連携・認証 応用 / 20250114-OIDF-J-EduWG-TechSWG
oidfj
2
680
Kotlin Multiplatformのポテンシャル
recruitengineers
PRO
2
150
Amazon Route 53, 待ちに待った TLSAレコードのサポート開始
kenichinakamura
0
170
DMMブックスへのTipKit導入
ttyi2
1
110
PaaSの歴史と、 アプリケーションプラットフォームのこれから
jacopen
7
1.5k
生成AIのビジネス活用
seosoft
0
110
今から、 今だからこそ始める Terraform で Azure 管理 / Managing Azure with Terraform: The Perfect Time to Start
nnstt1
0
240
カップ麺の待ち時間(3分)でわかるPartyRockアップデート
ryutakondo
0
140
JAWS-UG20250116_iOSアプリエンジニアがAWSreInventに行ってきた(真面目編)
totokit4
0
140
実践! ソフトウェアエンジニアリングの価値の計測 ── Effort、Output、Outcome、Impact
nomuson
0
2.1k
Featured
See All Featured
BBQ
matthewcrist
85
9.4k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
26
1.9k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
7
570
Typedesign – Prime Four
hannesfritz
40
2.5k
Stop Working from a Prison Cell
hatefulcrawdad
267
20k
Building a Scalable Design System with Sketch
lauravandoore
460
33k
Done Done
chrislema
182
16k
The Illustrated Children's Guide to Kubernetes
chrisshort
48
49k
Build your cross-platform service in a week with App Engine
jlugia
229
18k
Gamification - CAS2011
davidbonilla
80
5.1k
Side Projects
sachag
452
42k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
PRO
10
870
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() ←ෆม
Χʔωϧ ϢʔβΞϓϦέʔγϣϯΛ҆ఆͯ͠ ಈ࡞ͤ͞ΔͨΊʹઃܭ͞Ε͍ͯΔ →ࢀߟʹͳΔ
·ͱΊ
·ͱΊ • ྑ͍Ϟδϡʔϧͱʮؔ࿈ੑͷߴ͍ͨ͘͞ΜͷཁૉΛӅ࣋ͪ͠ɺҰൠత ͳέʔεͰ͍͘͢ෆมͳΠϯλʔϑΣʔεʹΑͬͯڧྗͳػೳΛఏ ڙ͢Δͷʯ • ࣮ݱ͢ΔͨΊʹʮϞδϡʔϧͷਂ͞ʯΛҙࣝ͢Δ • ͋͘·ͰҰͭͷߟ͑ํͰ͋ΔͨΊɺΣϧΧϜ
͋Γ͕ͱ͏͍͟͝·ͨ͠