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
フロントエンドのディレクトリ設計思想
Search
teppeita
October 16, 2023
Programming
24
24k
フロントエンドのディレクトリ設計思想
teppeita
October 16, 2023
Tweet
Share
More Decks by teppeita
See All by teppeita
GraphQLの社内ドキュメントを作った話
teppeita
0
190
Other Decks in Programming
See All in Programming
Exploring Type-Informed Lint Rules in Rust based TypeScript Linters
unvalley
3
650
Revisiting the Hotwire Landscape after Turbo 8 @ RailsConf 2024, Detroit
marcoroth
3
610
Using "modern" Ruby to build a better, faster Homebrew
mikemcquaid
2
300
Go製Webアプリケーションのエラーとの向き合い方大全、あるいはやっぱりスタックトレース欲しいやん / Kyoto.go #50
utgwkk
6
2k
Good first issues of TypeProf
mame
4
880
Namespace, What and Why
tagomoris
4
1.1k
Unlocking Potential of Property Based Testing with Ractor
ohbarye
2
520
TypeScriptで使いやすいOpenAPIの書き方
yukimochi_dwango
1
960
[RubyKaigi 2024] Ruby Mixology 101: adding shots of PHP, Elixir, and more
palkan
0
140
Exploring the Implementation of “t.Run”, “t.Parallel”, and “t.Cleanup”
akarin
1
160
How to improve maintainability and readability of your automated tests? ( #scrumniigata )
teyamagu
PRO
1
130
Three ways to use AI on Android: The Good, the Bad and the Ugly
marxallski
0
120
Featured
See All Featured
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
221
21k
The Power of CSS Pseudo Elements
geoffreycrofte
62
5k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
12
1.1k
Why You Should Never Use an ORM
jnunemaker
PRO
51
8.7k
Writing Fast Ruby
sferik
622
60k
Web Components: a chance to create the future
zenorocha
306
41k
Navigating Team Friction
lara
179
13k
ParisWeb 2013: Learning to Love: Crash Course in Emotional UX Design
dotmariusz
104
6.7k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
21
2k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
26
2.3k
Imperfection Machines: The Place of Print at Facebook
scottboms
261
12k
A Modern Web Designer's Workflow
chriscoyier
689
190k
Transcript
フロントエンドのディレクトリ設計思想 2023-10-11 ハッカー鮨 竹尾哲平(@_teppeita)
自己紹介 Index 1 ディレクトリについて 2 設計思想 3 マイベストの方針 4 まとめ
5
竹尾 哲平(@_teppeita) takeo teppei フロントエンドエンジニア デザインシステムとGraphQLに関心が有ります。 画像 自己紹介
ディレクトリ構成 どうしていますか? 画像 https://tabelog.com/tokyo/A1302/A130204/13018162/
ディレクトリ構成 どう考えるのが良いと思いますか? 画像 https://tabelog.com/tokyo/A1302/A130204/13018162/
どれを選びますか? フロントエンド界隈を見ると 世の中にはいろんなパターンが出回っています Atomic Design Features Directory App Directory Clean
Architecture Container / Presenter
アーキテクチャ全般の話から考えてみましょう 概念的な話として 設計思想:どう分けるか
どう分けるか、を キャッチーに命名 Layer型 Feature型
MVCとかも分類できますが、割愛します 先ほどあげた よくあるパターンを分類 Layer型 Feature型 Atomic Design Features Directory App
Directory Clean Architecture Container / Presenter (Micro Frontends)
よくあるパターンの導入理由や失敗事例を見ると分かりやすいです 分類ごとの Pros / Cons Layer型 Feature型 Pros ・処理の共通化がしや すい
Cons ・階層分けが難しい ・依存の管理が難しい Pros ・ドメインごとに疎結合 & 高凝集にできる Cons ・境界の定義が難しい ・処理の重複が発生
少し視点を変えて
Layer型・Feature型と似てますね 組織で考えてみると 機能別組織と事業部制組織が有ります
つまり、組み合わせて構成する 組織の場合 組織の構造は、ハイブリッドに帰結する 「共通の事業目的を持つすべての大組織は、最後にはハイブリッド組織形態に落ち着くことになる」 アンドリュー・S・グローブ. 『ハイアウトプットマネジメント』 .日経BP.2017
コンウェイの法則に従えば、 システムもハイブリッドが良い? →組み合わせ方を考える。
先ほどの Pros / Cons を再確認 Layer型 Feature型 Pros ・処理の共通化がしや すい
Cons ・階層分けが難しい ・依存の管理が難しい Pros ・ドメインごとに疎結合 & 高凝集にできる Cons ・境界の定義が難しい ・処理の重複が発生
どう組み合わせるか マイベストの方針 Layer型 Feature型 Pros ・処理の共通化がしや すい →Componentsに適用 Pros ・ドメインごとに疎結合・
高凝集にできる →Pagesに適用
Layer型を適用 Componentsディレクトリ Layer型 Pros ・処理の共通化がしや すい →Componentsに適用 ・デザインシステム構築中 ・Atomic Designをベースに議論して、独
自にカスタマイズした階層 (詳細話したいですが、今回は割愛) ・処理を共通化して複数箇所で扱いや すい
Feature型を適用 Pagesディレクトリ Feature型 Pros ・ドメインごとに疎結合・ 高凝集にできる →Pagesに適用 ・Next.jsのルーティングに合わせて機 能をまとめる ・App
Directoryに倣ってコロケーショ ン (pageExtensions optionを利用) ・境界の定義が明確で迷わない
※分かりやすさのために実際よりも簡略化しています マイベストの ディレクトリ全体像
まとめ ディレクトリ設計思想は 01 Layer型とFeature型 に分類できそう 02 2つの型の 組み合わせ を考える 03
マイベストでは componentsと pagesで組み合わせ