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
DI整備でneedleを使った話
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
kamui_project
October 31, 2022
Technology
0
300
DI整備でneedleを使った話
kamui_project
October 31, 2022
Tweet
Share
More Decks by kamui_project
See All by kamui_project
String Catalog
tony1224
1
2.3k
meetup_201910.pdf
tony1224
0
170
potatotips_201906.pdf
tony1224
0
89
potatotips_201905.pdf
tony1224
1
490
andfactory_201903.pdf
tony1224
0
1.2k
Dividing Model into layers and implementing Unit Test
tony1224
1
1.2k
WWDC18 cherry-pick Xcode 10 beta
tony1224
0
320
Other Decks in Technology
See All in Technology
Startups on Rails: 2026 at RubyConf Thailand
irinanazarova
0
130
自動テストが巻き起こした開発プロセス・チームの変化 / Impact of Automated Testing on Development Cycles and Team Dynamics
codmoninc
1
1.1k
Exadata Database Service on Dedicated Infrastructure(ExaDB-D) UI スクリーン・キャプチャ集
oracle4engineer
PRO
7
7.1k
GitLab Duo Agent Platform + Local LLMサービングで幸せになりたい
jyoshise
0
150
オンプレとGoogle Cloudを安全に繋ぐための、セキュア通信の勘所
waiwai2111
3
1.1k
ブラックボックス観測に基づくAI支援のプロトコルのリバースエンジニアリングと再現~AIを用いたリバースエンジニアリング~ @ SECCON 14 電脳会議 / Reverse Engineering and Reproduction of an AI-Assisted Protocol Based on Black-Box Observation @ SECCON 14 DENNO-KAIGI
chibiegg
0
150
JAWS Days 2026 楽しく学ぼう! 認証認可 入門/20260307-jaws-days-novice-lane-auth
opelab
2
830
Shifting from MCP to Skills / ベストプラクティスの変遷を辿る
yamanoku
3
450
「ストレッチゾーンに挑戦し続ける」ことって難しくないですか? メンバーの持続的成長を支えるEMの環境設計
sansantech
PRO
3
340
チームメンバー迷わないIaC設計
hayama17
5
3.9k
Oracle Database@Azure:サービス概要のご紹介
oracle4engineer
PRO
4
1.1k
LLM活用の壁を超える:リクルートR&Dの戦略と打ち手
recruitengineers
PRO
1
250
Featured
See All Featured
Ruling the World: When Life Gets Gamed
codingconduct
0
160
Building Experiences: Design Systems, User Experience, and Full Site Editing
marktimemedia
0
430
Code Review Best Practice
trishagee
74
20k
Exploring anti-patterns in Rails
aemeredith
2
280
A designer walks into a library…
pauljervisheath
210
24k
The #1 spot is gone: here's how to win anyway
tamaranovitovic
2
980
DBのスキルで生き残る技術 - AI時代におけるテーブル設計の勘所
soudai
PRO
62
51k
How Software Deployment tools have changed in the past 20 years
geshan
0
32k
Design of three-dimensional binary manipulators for pick-and-place task avoiding obstacles (IECON2024)
konakalab
0
370
Bash Introduction
62gerente
615
210k
Visual Storytelling: How to be a Superhuman Communicator
reverentgeek
2
460
What Being in a Rock Band Can Teach Us About Real World SEO
427marketing
0
190
Transcript
DI整備でneedleを使った話 2022/10/31 #79 potatotips
自己紹介 name: かむい @kamui_project company: REALITY Inc. potato tips latest
presentation: #62
弊社のDI整備のお話
note紹介 第1弾: needleでDI改善に取り組み始めた話 第2弾: needleでモジュール間の画面遷移を実 現した話 第3弾: ↑をSwiftUIで実現した話 「REALITY needle」
で検索すると出てきます
プロダクト環境の背景 リリース: 2018/8/4〜現在 主な出来事: 機能拡充, iOS新技術の積極採用, EN積極採用 View作成: UIKit →
SwiftUI / UIKit チーム文化: プレゼンテーションロジックのUnit Testは 積極的に書いている
プロダクト環境の背景 リリース: 2018/8/4〜現在 主な出来事: 機能拡充, iOS新技術の積極採用, EN積極採用 View作成: UIKit →
SwiftUI / UIKit チーム文化: プレゼンテーションロジックのUnit Testは 積極的に書いている → initializerのパラメータにデフォルト引数が 有ったり無かったり → Bastard Injection
Bastard Injection • DIのアンチパタン • デフォルト引数 → Testabilityの観点では問題は無い • DIの動機として他クラスへの依存を減らしたい
◦ 依存対象をI/Fに留めたい ◦ 結合が強くなる 弊社のDI整備 ⇨ Bastard Injectionの解消 + DIルールの整理 • DIルールの整理 ◦ 依存はI/Fに留める, ViewControllerの初期化ルール 等 ▪ 依存解決のためのコードを書く手間🤔 ▪ コンパイラセーフ🤔 DIの課題と整備
None
• オブジェクト間の依存解決コードをコンパイル時に自動 生成してくれるツール ◦ AndroidのDaggerと似ている ◦ コンパイル時にDI注入の安全性を確保 ▪ 自信を持ってコード変更ができる •
DI構造が階層的且つ実装上の登場人物が少なくシンプル • 誤ったDI注入があった際には問題箇所の変数名・型・階 層をエラー文で教えてくれる とは
とは https://github.com/uber/needle/blob/master/README.md
とは https://note.com/reality_eng/n/n124fd7da93c3
とは https://note.com/reality_eng/n/n124fd7da93c3
現在の状況と今後の展望 https://note.com/reality_eng/n/n124fd7da93c3
現在の状況と今後の展望 https://note.com/reality_eng/n/nbe40c0e17690
現在の状況と今後の展望
• 課題: Bastard InjectionなDIをしていた箇所が多く存在 • アクション: DIの整備を進めていく中で、依存問題解決のコー ド生成をneedleを使い自動化 • 現状:
起動画面ほか複数の画面で導入・拡充を進める • 今後の展望: モジュール間の画面遷移もneedleの仕組みを介す 形で実現していきたい まとめ
最後に
最後に