タグ

diに関するbopperjpのブックマーク (14)

  • Dagger Hilt (DevFest 2020 資料) - Qiita

    DevFestの資料の記事版です。ステップごとにサンプルアプリの差分付きで説明します。 なぜDependency Injectionが必要なのか から始め、Dagger Hiltの説明、実践的なプラクティスまで説明していきます! Dependency Injection(DI)とはなにか なぜDIが必要なのか DI、ちょっと難しいイメージありますが、そもそもなんで必要なんでしょうか? 作っているのが動画再生するアプリでVideoPlayerというクラスがあるとしましょう。 VideoPlayerのクラスの中にデータベースやcodecなどがハードコードされています。 コード: https://github.com/takahirom/hilt-sample-app/commit/8c36602aaa4e27d8f10c81e2808f0ff452f1c8a4#diff-bbc9d28d8bc

    Dagger Hilt (DevFest 2020 資料) - Qiita
  • 作って理解するDIコンテナ - きしだのHatena

    DIコンテナ使ってるけど、アノテーションってなんなの!って聞かれて、作ってみたらわかるよと答えてみたので、自分でも作ってみました。 よくわかった。 「DIコンテナ使うと何がいいの?」ということも、作ってみるとわかります。あと「DIって何がいいの?」に関しては、「DIはちょっとコードを書くのが楽になるだけで、それだけあっても仕方ない、大事なのはコンテナ」と答えるようにしてますが、コード比率からもそれがよくわかります。 続編としてWebフレームワークも作っているので参考まで。 作って理解するWebフレームワーク - きしだのHatena まずはコンテナを作る とりあえず1ソースの状態で。 こんな感じで、管理する型を登録できるようにします。 static Map<String, Class> types = new HashMap<>(); static void register(String

    作って理解するDIコンテナ - きしだのHatena
  • Fragmented Ep. 21: Diving Deep with Dagger - hydrakecat’s blog

    恒例の Fragmented レビュー。今回は第21回の Diving Deep with Dagger について。久しぶりに Donn と Kaushik の2人だけの回だが、カメオ出演(というのか?)で Square の Jesse Wilson が出ている。 Dagger さて Dagger と Dagger 2 である。どちらも Android では有名な Dependency Injection (DI) のライブラリだ。 実を言うと、Dagger は自分にとっては「いつか使いたいと思いつつ、使えていない」ライブラリの1つだ。学習コストがそれなりにかかりそうで、ぱっと目につくメリットがそんなにないと二の足を踏んでしまう。良くない癖だ。だから、そんな自分にとっては、このエピソードは Dagger を勉強する良い機会だった。 珍しく最初に雑談があって、Game of Thrones

    Fragmented Ep. 21: Diving Deep with Dagger - hydrakecat’s blog
  • HK2 - Dependency Injection Kernel

    HK2 is an implementation of JSR-330 in a JavaSE environment. JSR-330 defines services and injection points that can be dynamically discovered at runtime and which allow for Inversion of Control (IoC) and dependency injection (DI). HK2 provides an API for control over its operation and has the ability to automatically load services into the container. It is the foundation for the GlassFish V3 and V

  • Google Guice 使い方メモ - Qiita

    Google Guice の使い方メモ。 Wiki の User's Guide をざっと試してみた。 特徴とか 読みは「ジュース」 Google が開発してる DI コンテナ ver 3.0 からは JSR330(Dependency Injection for Java)のリファレンス実装 設定は XML ではなく Java コード中に書く アノテーションと型引数をフル活用 2013/10/31 現在の最新は 3.0(4.0 の Beta 版が公開されてる) 環境

    Google Guice 使い方メモ - Qiita
  • http://www.typhoonframework.org/

  • Dagger † Android・Java 対応の高速依存性注入フレームワーク

    注意 語訳は、Dagger ユーザガイドの 2013-03-27 時点 からの非公式な翻訳です。最新および正確な情報については、オリジナルのユーザガイドを参照してください。 イントロダクション アプリケーションで最良のクラスとは、何かを実行するクラスです。 たとえば、バーコード読み取りクラス BarcodeDecoder 、 Koopa 物理エンジンクラス KoopaPhysicsEngine、 音楽ストリーミングクラス AudioStreamerといった類です。こういったクラスは別のクラスへの依存性を持ちます(バーコードカメラファインダクラス BarcodeCameraFinder、 デフォルトの物理エンジンクラス DefaultPhysicsEngine、 HTTPストリーミングクラス HttpStreamer 等々)。 一方で、アプリケーションで最悪のクラスとは、ほとんど何もし

  • Android用DIコンテナDaggerはGuiceの数倍速い - _development,

    概要 Android用のDIコンテナDaggerのパフォーマンスをGuiceと比較しました。 Dagger自体の使い方などは述べていませんので、公式サイトのドキュメントなどを参照してください。 DaggerはSquare社製のAndroidをターゲットにしたDIコンテナです。 開発者の一人であるJesse Wilson氏がプレゼンテーション(InfoQ - Dagger: A Fast Dependency Injector for Android and Java)のなかで It's like Guice, but with speed instead of features と述べているように、Guiceと同じくJSR330のAnnotationを使ってオブジェクトの依存関係を記述します。また、上述のとおりGuiceでサポートされている機能のいくつかはサポートしないかわりにパフォーマン

    Android用DIコンテナDaggerはGuiceの数倍速い - _development,
  • Transfuse

    Transfuse is a Java Dependency Injection (DI) and integration library geared specifically for the Google Android API. There are several key features that make Transfuse a great framework to use with Android: Dependency Injection - Transfuse implements the JSR-330 standard annotations and passes the included unit tests. POJO Components - Transfuse gives users the ability to develop Android componen

    Transfuse
  • RoboGuice 2.0 で Dependency を Injection しました - Just posted a blog

    だるすぎ— 高意識エネルギー体さん (@mizchi) 12月 1, 2012 “はじめてのDependency Injection - _development,” htn.to/yoYFMc— 高意識エネルギー体さん (@mizchi) 12月 1, 2012 人間はだるくない開発がしたい。 そこで、DIフレームワークを使うことにした。 Deep dive into RoboGuice beyond “Hello World apps” “RoboGuice 2 smoothes out some of the wrinkles in your Android development experience and makes things simple and fun!” ということらしいので、RoboGuice入れてみた。 インストール maven使ってないので Instal

  • Dagger

    Deprecated – Please upgrade to Dagger 2 Square's Dagger 1.x is deprecated in favor of Google's Dagger 2. Please see the migration guide for help with the upgrade. Introduction The best classes in any application are the ones that do stuff: the BarcodeDecoder, the KoopaPhysicsEngine, and the AudioStreamer. These classes have dependencies; perhaps a BarcodeCameraFinder, DefaultPhysicsEngine, and an

  • はじめてのDependency Injection - _development,

    Android Advent Calendar 2012 に参加しています。 エントリはDependency InjectionによるAndroidアプリケーションの実装とテストの一方法について述べています。 文中に出てくるコードは全てgithubから取得できます。 Dependency Injectionとは簡単にいうと、あるオブジェクトが依存しているオブジェクト(以下、Dependency)を別の誰かが注入(以下、Injection)してあげることでオブジェクトの関係を疎結合にする方法です。 Dependencyを誰かがInjectionしてくれると、なにがいいのか? まず、逆に誰もInjectionしてくれない場合を考えてみます。 Dependency Injection 前 誰もInjectionしてくれない場合は自分でDependencyを設定するしかありません。 たとえば、天

    はじめてのDependency Injection - _development,
  • RoboGuiceでAndroidアプリのDI開発

    今更ながらRoboGuiceを使ってみたので忘れずメモ。 RoboGuiceについて簡単に触れておくとGoogle GuiceベースのAndroid用のDIコンテナである。 roboguice - Project Hosting on Google Code 細かいViewの制御は抜きにして以下のようなアプリを例としてRoboGuiceを使用して作成してみる。 トップ画面より入力された名前を次の画面で文字列を付け足して表示する。 まず前エントリーを参考にMavenプロジェクトからAndroidプロジェクトを作成。 pom.xmlを追記 <dependency> <groupId>org.roboguice</groupId> <artifactId>roboguice</artifactId> <version>1.1.2</version> </dependency> TopActivi

    RoboGuiceでAndroidアプリのDI開発
  • google-guice - Google Code

    Put simply, Guice alleviates the need for factories and the use of new in your Java code. Think of Guice's @Inject as the new new. You will still need to write factories in some cases, but your code will not depend directly on them. Your code will be easier to change, unit test and reuse in other contexts. Guice embraces Java's type safe nature. You might think of Guice as filling in missing featu

    google-guice - Google Code
    bopperjp
    bopperjp 2011/05/25
    androidでも使えるか?
  • 1