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
The Role of Developer Relations in AI Product Success.
giftojabu1
0
120
Python(PYNQ)がテーマのAMD主催のFPGAコンテストに参加してきた
iotengineer22
0
470
CysharpのOSS群から見るModern C#の現在地
neuecc
2
3.1k
オープンソースAIとは何か? --「オープンソースAIの定義 v1.0」詳細解説
shujisado
6
670
SSMRunbook作成の勘所_20241120
koichiotomo
2
130
リンクアンドモチベーション ソフトウェアエンジニア向け紹介資料 / Introduction to Link and Motivation for Software Engineers
lmi
4
300k
AWS Lambda のトラブルシュートをしていて思うこと
kazzpapa3
2
170
Shopifyアプリ開発における Shopifyの機能活用
sonatard
4
250
社内で最大の技術的負債のリファクタリングに取り組んだお話し
kidooonn
1
550
Platform Engineering for Software Developers and Architects
syntasso
1
510
ドメイン名の終活について - JPAAWG 7th -
mikit
33
20k
AGIについてChatGPTに聞いてみた
blueb
0
130
Featured
See All Featured
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
42
9.2k
Why You Should Never Use an ORM
jnunemaker
PRO
54
9.1k
Agile that works and the tools we love
rasmusluckow
327
21k
The World Runs on Bad Software
bkeepers
PRO
65
11k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
29
2.3k
How to Ace a Technical Interview
jacobian
276
23k
How to Think Like a Performance Engineer
csswizardry
20
1.1k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
8
860
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
109
49k
Reflections from 52 weeks, 52 projects
jeffersonlam
346
20k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
26
2.1k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
28
9.1k
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() ←ෆม
Χʔωϧ ϢʔβΞϓϦέʔγϣϯΛ҆ఆͯ͠ ಈ࡞ͤ͞ΔͨΊʹઃܭ͞Ε͍ͯΔ →ࢀߟʹͳΔ
·ͱΊ
·ͱΊ • ྑ͍Ϟδϡʔϧͱʮؔ࿈ੑͷߴ͍ͨ͘͞ΜͷཁૉΛӅ࣋ͪ͠ɺҰൠత ͳέʔεͰ͍͘͢ෆมͳΠϯλʔϑΣʔεʹΑͬͯڧྗͳػೳΛఏ ڙ͢Δͷʯ • ࣮ݱ͢ΔͨΊʹʮϞδϡʔϧͷਂ͞ʯΛҙࣝ͢Δ • ͋͘·ͰҰͭͷߟ͑ํͰ͋ΔͨΊɺΣϧΧϜ
͋Γ͕ͱ͏͍͟͝·ͨ͠