タグ

DIに関するmizogucheのブックマーク (3)

  • DIコンテナのインジェクション方法の使い分けについて - 日々常々

    DIコンテナを使う時にどのインジェクションを使うかって話です。 たぶん誰かがどこかで同じようなことを書いているだろうけれど、気にせず書くよ。 「他の誰かが書いている」なんてのを書かない理由にしてると何も書けなくなるし。 コンテナ DIコンテナのこと。 コンテナ管理 インスタンスのライフサイクルをコンテナが管理していること。雑に言えば、使う側で new しないってこと。 インジェクション Dependency Injectionのこと。 Short Answer コンストラクタインジェクションを使いましょう。使い分けなくていいです。 3種類のインジェクション インジェクションには3種類ありますね。他あっても知らない。 フィールドインジェクション セッターインジェクション コンストラクタインジェクション フィールドインジェクション 一番よく見るかな。 class Hoge { @Inject

    DIコンテナのインジェクション方法の使い分けについて - 日々常々
    mizoguche
    mizoguche 2017/04/17
    いい話
  • GitHub - atomicobject/objection: A lightweight dependency injection framework for Objective-C

    Description Objection is a lightweight dependency injection framework for Objective-C for MacOS X and iOS. For those of you that have used Guice, Objection will feel familiar. Objection was built to stay out of your way and alleviate the need to maintain a large XML container or manually construct objects. Features "Annotation" Based Dependency Injection Seamless support for integrating custom and

    GitHub - atomicobject/objection: A lightweight dependency injection framework for Objective-C
    mizoguche
    mizoguche 2013/08/09
    "For those of you that have used Guice, Objection will feel familiar."なiOSのDIフレームワーク。
  • はじめての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,
    mizoguche
    mizoguche 2012/12/01
    AndroidでDI
  • 1