並び順

ブックマーク数

期間指定

  • から
  • まで

1 - 34 件 / 34件

新着順 人気順

dependency-injectionの検索結果1 - 34 件 / 34件

タグ検索の該当結果が少ないため、タイトル検索結果を表示しています。

dependency-injectionに関するエントリは34件あります。 DIandroidテスト などが関連タグです。 人気エントリには 『「DIは必ずしも善ではない」| Dependency injection is not a virtue by DHH』などがあります。
  • 「DIは必ずしも善ではない」| Dependency injection is not a virtue by DHH

    DHHの Dependency injection is not a virtue(2013) という記事は有名ですが、ちゃんとした日本語訳が意外とないようなので、書き出してみて思ったことを要約してみた。[1] Rubyのエンジニアの中には、何も考えずに他のモデルのnewを書いてる人の割合が多いという(コードレビュー時のヒアリングによる)体感があり、また8年前の記事なので経験の浅い人は読んだことがない人もいると思う。該当する方は是非読んでほしい。 全部読む時間が無い人は要約へ. 原文と訳文 In languages less open than Ruby, hard-coded class references can make testing tough. If your Java code has Date date = new Date(); buried in its guts,

      「DIは必ずしも善ではない」| Dependency injection is not a virtue by DHH
    • なぜDependency Injectionなのか? ~関心の分離と疎結合~

      本稿は「アーキテクチャを突き詰める Online Conference」における発表「なぜDependency Injectionなのか? ~関心の分離と疎結合~」の登壇原稿となります。 発表時の動画アーカイブは後日公開されたタイミングでリンクを追加いたします。 また、本稿のサンプルコードとPower PointはGitHubで公開しています。 「CC BY-SA 4.0」で公開していますので、気に入っていただけたら営利目的含め、ライセンスの範囲で自由に利用していただいて問題ありません。 https://github.com/nuitsjp/WhyDependencyInjection というわけで、本稿の目指すゴールはこちら。 今日は、この場にいる皆さんが「なぜDependency Injectionを利用するのか?」ということを、理解いただくのが本日のゴールとなります。 というわけで本

        なぜDependency Injectionなのか? ~関心の分離と疎結合~
      • ゼロから理解するDependency Injection - inSmartBank

        Dependency Injection (DI) とは、オブジェクトに必要な依存関係を外から注入する設計パターンです。 本記事ではiOSアプリの実装をテーマに、DIがなぜ必要なのか、さらにはDI Containerとは何を解決するためにあるのかについて具体的な実装例をもとに解説します。 ※ 本記事は iOS Test Night #12 にて発表した内容を書き起こしたものとなっております。 speakerdeck.com Dependency Injection 依存を内部で初期化する書き方 依存性逆転の原則に従った書き方 DI Containerの基本 Daggerに学ぶ依存のライフタイム管理 SwiftUIアプリにおけるDI Containerの実装例 DI Containerの実装 Viewの実装 まとめ Dependency Injection Dependency Inject

          ゼロから理解するDependency Injection - inSmartBank
        • Introduction to Dependency Injection 「DI」の整理とそのメリット

          2022年11月に行われた、Dependency Injectionに関する社内共有会の資料です。 DIという言葉の整理と実用例を紹介しています。

            Introduction to Dependency Injection 「DI」の整理とそのメリット
          • Cloudflare Workers で Dependency Injection

            NOT A HOTEL ではガッツリ Cloudflare Workers の上でアプリケーションを動かしています。 本格的にアプリケーションを開発しようとすると、ある機能 A を作成するために、それに依存する機能 B、機能 C を事前にセットアップしなければいけません。これらをスッキリさせる手法として Dependency Injection(以下 DI)があります。 環境変数もセットアップに必要な機能です。うちではどのように DI を行なっているか、一つの事例として紹介します。言語は TypeScript です。 ディレクトリ構成 di.ts を worker.ts と同じ階層に作成しています。 di.ts の中身 以下のようなコードを書いています。 使う時は new DIContainer(env, req) もしくは new DIContainer(env) と記述して利用できます

              Cloudflare Workers で Dependency Injection
            • DI(Dependency Injection)のメリットを理解する

              @Injectable() export class Test1Service { getName() { return { name: "john" }; } } @Controller("test1") export class Test1Controller { constructor(private readonly test1Service: Test1Service) {} @Get() getName() { return this.test1Service.getName(); } } Nest CLI でプロジェクトを作成したときに生成されるコードはこんな感じになっていると思います。 service での処理を controller で呼び出すことができているくらいにしか思いません。 このサービスは必ずしも、DI しないと使えないわけではなく、通常のクラスなので、インスタ

                DI(Dependency Injection)のメリットを理解する
              • Dependency Injectionでやりたいことはモジュールimport - きしだのHatena

                Dependency Injection(DI)、最近のフレームワークには欠かせない気がする機能になってますね。 そしてDIの説明をみると「依存性の注入」みたいなことが書いてあって、ようわからんになりがちです。 実態としては高機能なimportなので、あまり難しいことを考えなくていいような気がします。 たとえば、こんな感じのMyServiceクラスがあってDIコンテナに管理させるとします。 @Component class MyService { void method() { } } そして、MyServiceを使うMyControllerがあるとします。 @Component class MyController { @Inject MyService service; void hello() { service.method(); } } これって、実際のところMyServiceの

                  Dependency Injectionでやりたいことはモジュールimport - きしだのHatena
                • wire で Dependency Injection しよう

                  Magic Moment の @aqlwah です。 私たちが開発している Magic Moment Playbook では、モジュール間の依存の管理を楽にするため wire を活用しています。 とても便利なツールですが、wire が行う Dependency Injection (DI:依存性の注入)がいまいち直感的に理解しづらく、弊チームでもバックエンドの新規参画者を迷わせる要因となっています。 本稿では、これから弊チームで wire に手間取る人が出ないことを願って、ざっくり wire の役割をまとめます。 DI って何よ wire は Dependency Injection (DI:依存性の注入)のためのツールです。 DI とは端的に言うと、「依存するモジュールを自分で生成せず、外部から受け取る(注入する)」デザインパターンです。 // without DI type Greet

                    wire で Dependency Injection しよう
                  • Python で DI(Dependency Injection) を実現するフレームワークの Injector を使ってみる | DevelopersIO

                    Python で DI(Dependency Injection) を実現するフレームワークの Injector を使ってみる Python コードの品質向上のために、DI(Dependency Injection) フレームワークの injector を導入してみました。 はじめに こんにちは、筧( @TakaakiKakei )です。 所属しているチームでは、開発言語として python をよく使っています。 そして最近、コード品質向上のために injector を導入しました。 alecthomas/injector: Python dependency injection framework, inspired by Guice injector は python で DI を実現するフレームワークです。 私は DI 初心者で、同僚のコードを読み解きながら理解を進めている状況です。

                      Python で DI(Dependency Injection) を実現するフレームワークの Injector を使ってみる | DevelopersIO
                    • 依存性注入(Dependency Injection: DI)について理解する

                      株式会社TOKIUMでAndroidエンジニアをしている渡邊(@error96num)です。ここ数年は"injection"というとワクチン注射が思い浮かびますが、本記事ではアプリ開発において欠かせないinjection、依存性注入(Dependency Injection: DI)という概念について解説します。 対象読者 以下のような方を想定しています。 依存性注入(Dependency Injection: DI)に馴染みがなく、ざっくり理解したい DIフレームワークを使ったアプリ開発をしているが、基礎にたちかえってDIの目的やメリットについて今一度理解したい 依存性注入 (Dependency Injection: DI) Android公式のドキュメント[1]にも登場するCar, Engineクラスを使った例で、Kotlinでの実装を交えてDIについて解説します。 多くの場合、クラ

                        依存性注入(Dependency Injection: DI)について理解する
                      • 実戦での Scala: Cake パターンを用いた Dependency Injection (DI) · eed3si9n

                        2011-04-23 Akka の作者として益々注目を集めている Jonas Bonér が 2008年に書いた “Real-World Scala: Dependency Injection (DI)” を翻訳しました。翻訳の公開は本人より許諾済みです。翻訳の間違い等があれば遠慮なくご指摘ください。 2008年10月6日 Jonas Bonér 著 2011年4月22日 eed3si9n 訳 さて、実戦での Scala シリーズ第二弾の今回は、Scala を用いた Depenency Injection (DI) の実装をみていきたい。Scala は、備わっている言語機構だけを用いても何通りかの DI を実現できる非常に豊かでディープな言語だが、必要に応じて既存の Java DI フレームワークを使うこともできる。 Triental では、一つの戦略に落ち着くまで三つの異なる方法を試した

                        • A New, Simpler Way to Do Dependency Injection in Go

                          Dependency injection (DI) is a great thing. Even if you haven’t heard of the term, it’s likely that you have already used it. This article assumes zero existing knowledge of DI. However, a basic understanding of Go. I will work from fundaments, challenges, solutions and eventually lead to how to build a complete service container. Anatomy of This…

                            A New, Simpler Way to Do Dependency Injection in Go
                          • Dependency Injection: 依存性の注入 のお役立ち例 - Qiita

                            はじめに 「Dependency Injection: 依存性の注入」 って、とっても分かりづらくないですか? 色んなところに解説記事があって、Qiitaでも検索すると沢山見つかりますが筆者は文章を読んだだけでは全然分かりませんでした。 「直接呼び出すのではなく、インターフェースを介して実装する?」「制御の反転(inversion of control)? 中から外ではなく外から中?」「サンプルを真似てみたけど複雑な実装している。これ何が嬉しいの?」そんな疑問ばかりでした。言葉は知っているけど使えないってやつです。 ようやく理解できたのは、実際に「あれ?困ったぞ」となって「ここでDIを使うと便利なのか!」と実感してからでした。 「ここで便利なんだ!」や「こういう時に使うといいんだ!」という使い所が分かると応用が効き、これが本当に理解することなんだなと思いましたので、それを書いてみたいと思い

                              Dependency Injection: 依存性の注入 のお役立ち例 - Qiita
                            • google/wireを使ってGoでDI(dependency injection)してみる | ビジネスとIT活用に役立つ情報(株式会社アーティス)

                              フローを把握する wireを使ってのDIは、以下のフローになります。 「DIしたい対象を生成する関数」を生成する関数を定義する wireコマンドで、上記のファイルから「DIしたい対象を生成する関数」をジェネレートする その関数を利用する 他の言語のDIコンテナと比べると、すこしフローが違うので最初は戸惑うかもしれません。 DIコンテナ(とその設定)を、メタ的に自動生成するイメージに近いかと思います。 チュートリアルで動きを確認する こちらの公式のチュートリアルを動かしながら動作を確認していきます。 https://github.com/google/wire/blob/master/_tutorial/README.md まずは、手動でDIするコードで動きを理解しておきます。(予習は大事です) main.go を作りその中に以下のコードを書き込みます。 package main impor

                                google/wireを使ってGoでDI(dependency injection)してみる | ビジネスとIT活用に役立つ情報(株式会社アーティス)
                              • Dependency Injection Guidance on Android — ADS 2019

                                According to our introduction to Dependency Injection (DI), we believe you should always use DI principles in your applications. If you’re developing a professional Android app, use Dagger to better manage your dependencies. We recommended using Dagger for medium and large apps; for small apps or pet projects, it doesn’t matter the tool you use, but the sooner you add Dagger to your project, the b

                                  Dependency Injection Guidance on Android — ADS 2019
                                • Dependency Injection in Swift using latest Swift features

                                  Dependency Injection is a software design pattern in which an object receives other instances that it depends on. It’s a commonly used technique that allows reusing code, insert mocked data, and simplify testing. An example could be initializing a view with the network provider as a dependency. There are many different solutions for dependency injection in Swift, which all have their own pros and

                                    Dependency Injection in Swift using latest Swift features
                                  • Angular8 Dependency Injection まとめ - Qiita

                                    この記事は Angular Advent Calendar 2019 三日目の記事です。 こんにちは。カルテットコミュニケーションズ で働いている @ringtail003 です。この記事は、公式ドキュメント Angular の依存性の注入 | angular.jp を読みつつ手元で試して理解した事を「こう書いたら、こう動く」視点でまとめたものです。クッソ長いですが、ナナメ読みして後からかんたんにテキスト検索できるように情報をてんこ盛りにしておきましたので、ぜひ開発の参考にしていただけたらと思います。 この記事の対象読者: 公式ドキュメントを読んで「なるほど、よく分からん!」になっている人 なんとなく DI 使っているけど時々詰まる人 この記事を書いた環境: node v12.13 @angular/cli 8.3.12 記事の中のサンプルコードは GitHub にて公開しています。 テス

                                      Angular8 Dependency Injection まとめ - Qiita
                                    • Dependency injection in Android  |  Android Developers

                                      Dependency injection in Android Stay organized with collections Save and categorize content based on your preferences. Dependency injection (DI) is a technique widely used in programming and well suited to Android development. By following the principles of DI, you lay the groundwork for good app architecture. Implementing dependency injection provides you with the following advantages: Reusabilit

                                        Dependency injection in Android  |  Android Developers
                                      • A Dependency Injection Showdown

                                        Choosing a dependency framework for your Android app is a big decision, it’s not something that you can easily replace later on. Dependency injection spans all layers of your app so it’s important that the DI framework that you choose meets all your requirements and that includes testing. I am going to compare 4 popular frameworks: Dagger, Koin, Kodein, and Toothpick. It’s interesting that all of

                                          A Dependency Injection Showdown
                                        • DI(Dependency Injection) の解説 - Qiita

                                          DI とは何か DI を利用するメリット・デメリット Autofacを利用した例 Autofacのさらなる機能 その他 DI とは何か Wikipediaでは以下のように説明されている。 コンポーネント間の依存関係をプログラムのソースコードから排除し、外部の設定ファイルなどで注入できるようにするソフトウェアパターンである。 言い換えると あるコンポーネントAが利用している別のコンポーネントBを外部から注入することにより、コンポーネントAがコンポーネントBの実装との依存関係を排除するデザインパターン。 となる。 例 まずは DIを使わない場合 ///<summary>メインプログラム</summary> class Program{ public void Main(){ var client = new FooClient(); client.Execute(); } } ///<summ

                                            DI(Dependency Injection) の解説 - Qiita
                                          • GitHub - zheksoon/dioma: Elegant dependency injection container for vanilla JavaScript and TypeScript

                                            You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session. Dismiss alert

                                              GitHub - zheksoon/dioma: Elegant dependency injection container for vanilla JavaScript and TypeScript
                                            • 段階的に理解する Dependency Injection - Qiita

                                              はじめに Dependency Injection (以下 "DI" と略す) とは、コンポーネントの依存関係にまつわる諸問題をいい感じに解決してくれる機構である。「コンポーネントの依存関係」とは、例えば一般的なレイヤードアーキテクチャでの Controller → Service → Repository といった上位層から下位層につながるような関係のことを指す。「いい感じに解決」とは、開発者が手動で頑張らなくてもフレームワークが良きに計らってくれることを意味する。 モダンな Java アプリケーション開発において、DI はほぼ必須の機構である。筆者は主にバックエンドを主戦場としてアプリケーションの開発と運用に携わっているが、Web アプリケーションであろうがコマンドラインから起動するバッチであろうが、Java でアプリケーションを開発するのであれば使い捨てを除くほとんどの場合で DI

                                                段階的に理解する Dependency Injection - Qiita
                                              • GitHub - samber/do: ⚙️ A dependency injection toolkit based on Go 1.18+ Generics.

                                                ⚙️ A dependency injection toolkit based on Go 1.18+ Generics. This library implements the Dependency Injection design pattern. It may replace the uber/dig fantastic package in simple Go projects. samber/do uses Go 1.18+ generics and therefore offers a typesafe API. See also: samber/lo: A Lodash-style Go library based on Go 1.18+ Generics samber/mo: Monads based on Go 1.18+ Generics (Option, Result

                                                  GitHub - samber/do: ⚙️ A dependency injection toolkit based on Go 1.18+ Generics.
                                                • Python Dependency Injection

                                                  Writing clean, maintainable code is a challenging task. Fortunately, there are many patterns, techniques, and reusable solutions available to us to make achieving that task much easier. Dependency Injection is one of those techniques, which is used to write loosely-coupled yet highly-cohesive code. In this article, we'll show you how to implement Dependency Injection as you develop an app for plot

                                                    Python Dependency Injection
                                                  • Dependency injection in Remix loaders and actions by sergiodxa

                                                    Dependency Injection is a way our function or class can receieve from the caller the instancies of some dependencies the function/class have Let's say we have a function that sent a query to a DB, we could import directly the DB connection object and send the query, or we could receive the DB connection object as an argument if it follows a specific interface our function expects. interface DBConn

                                                    • Dependency injection with Hilt  |  Android Developers

                                                      Modern Android Quickly bring your app to life with less code, using a modern declarative approach to UI, and the simplicity of Kotlin.

                                                        Dependency injection with Hilt  |  Android Developers
                                                      • Dependency Injection in Compose

                                                        OverviewDependency injection is a programming pattern which prescribes that classes do not construct instances of their dependencies, instead such instances are provided. This pattern enables separation of concerns, and increases testability, reusability, and ease of maintenance. See Dependency injection in Android to review the benefits of dependency injection and its core concepts. You may alrea

                                                          Dependency Injection in Compose
                                                        • 【C#】Dependency Injection(依存性の注入)とは - Annulus Games

                                                          今回の記事はDependency Injection(依存性の注入)について。 設計についての学習を始めると「依存性の逆転」「Dependency Injection(依存性の注入)」「DIコンテナ」など言葉を耳にする機会が増えてくると思います。適切にDIを扱えるようになると設計の柔軟性が飛躍的に向上するため、是非とも習得したい知識です。 今回は「そもそもDependency Injection(依存性の注入)とは何なのか」という話から始め、サービスロケータやDIコンテナについてまで解説していきたいと思います。 またこの記事ではSOLID原則(特に依存性の逆転)等の知識を前提として進めるため、設計何もわからん!という方は以下の記事から読むことをお勧めします。記事の後半で依存性の逆転について触れているため、その辺りを押さえてからDIについて学ぶと良いでしょう。

                                                            【C#】Dependency Injection(依存性の注入)とは - Annulus Games
                                                          • Dependency injection on Android with Hilt

                                                            Dependency injection (DI) is a technique widely used in programming and well suited to Android development, where dependencies are provided to a class instead of creating them itself. By following DI principles, you lay the groundwork for good app architecture, greater code reusability, and ease of testing. Have you ever tried manual dependency injection in your app? Even with many of the existing

                                                              Dependency injection on Android with Hilt
                                                            • テストのためのDI(Dependency Injection)パターンを考える - Qiita

                                                              k2moons@BlueEventHorizonです。昨年から気になっていたテストとDIについてやっと書くことができました。お正月休みでは終わらず成人式を含んだ3連休も最終日まで掛かってしまいました。😭 はじめに DI(Dependency Injection)はよく使われる手法ですが、テストの文脈で語られることが多いようです。 そしてテストの実現容易性のためにDI(Dependency Injection)を用いることの有用性は疑う余地がないでしょう。 しかし、実際にDIを用いる場合、どのような視点のDependencyであって、それがどのような理由でInjectionされるとのかという点でいくつかのバリエーションがあり、それについて考察することは有意義ではないでしょうか。 この記事では、特にテストを行うためのDIと言う文脈で、日頃考えていることを書き連ねていきます。少しでもお役に立て

                                                                テストのためのDI(Dependency Injection)パターンを考える - Qiita
                                                              • React Context for dependency injection not state management

                                                                  React Context for dependency injection not state management
                                                                • ASP.NET CoreのDependency Injection 〜【その1】とりあえず使ってみよう 〜 | SIOS Tech. Lab

                                                                  【4/18開催】VSCode Dev Containersで楽々開発環境構築祭り〜Python/Reactなどなど〜 Visual Studio Codeの拡張機能であるDev Containersを使ってReactとかPythonとかSpring Bootとかの開発環境をラクチンで構築する方法を紹介するイベントです。 https://tech-lab.connpass.com/event/311864/ こんにちは、サイオステクノロジー技術部 武井です。今回は、APS.NET Coreの主要な機能の一つであるDelendency Injection(以降、DIと呼称)について、書きたいと思います。 DIはビジネスロジックの中ではインターフェースだけを定義し、その実装を外部から注入(Injection)するという実装方法で、レトロなところでいいますと、JavaのフレームワークであるSeas

                                                                    ASP.NET CoreのDependency Injection 〜【その1】とりあえず使ってみよう 〜 | SIOS Tech. Lab
                                                                  • JavaScript dependency injection in Node.js – introduction

                                                                    Digital Product Design Make your product the first choice for users with designers who built dozens of them. Agile Development Teams Work with product experts with the know-how tested in 7+ industries.

                                                                      JavaScript dependency injection in Node.js – introduction
                                                                    • Dependency Injection: Python

                                                                      OverviewDependency Injection(DI) is a software engineering technique for defining the dependencies among objects. Basically, the process of supplying a resource that a given piece of code requires. The required resource is called dependency. There are various classes and objects defined when writing code. Most of the time, these classes depend on other classes in order to fulfill their intended pu

                                                                        Dependency Injection: Python
                                                                      1

                                                                      新着記事