タグ

AndroidとDIに関するbopperjpのブックマーク (8)

  • 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
  • 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開発
  • 1