#Dependency-Injection
20 notas · última:
What you should be doing is stating a need, "I need something to drink with lunch," and then we will make sure you have something when you sit down to eat.
Resposta de John Munsch no Stack Overflow (2009) à pergunta sobre como explicar injeção de dependência a uma criança de cinco anos; é a mais votada da página.
How to explain dependency injection to a 5-year-old?
The answers explain dependency injection as providing an object with what it needs from outside, so it does not create or manage those dependencies itself, which makes testing and reuse easier.
Dependency injection in Ember.js - Going deeper
The post explains how Ember sets up container dependencies, how `register` and `inject` work, why components and views default to new instances, and how `container.lookup` ties caching and instantiation together.
Fascinating Dependency Injection
The article explains Angular dependency injection as a hierarchical lookup tied to the DOM, then shows how providers, factory functions, and tokens can reduce boilerplate and solve dynamic and shared-state cases.
How to handle external dependencies of your domain in a command-event architecture
The article compares five ways to handle external dependencies in a command-event architecture domain, from classic injection to the reader monad, and concludes in favor of internal commands with explicit dependencies.
Default Interface Implementations in C#: Where Inheritance Goes to Troll You
Default interface implementations in C# can change behavior when a class gains a base class. The article shows why a service starts returning the interface default and suggests ways to avoid it.
Dependency Injection made simple
The page explains dependency injection as passing an object to the constructor or setter of a dependent class, which decouples the code, makes testing easier, and uses interfaces in strongly typed languages.
Dynamically Change the ServiceLifetime of a Registered Service in .NET
The article shows how to replace a registration in IServiceCollection with another one with a different ServiceLifetime, using Replace and extension methods to swap implementation and environment.
Keeping cross-cutting concerns out of application code
Mark Seemann refactors a Polly-coupled API class into application code with zero third-party dependencies, moving fault tolerance into a Decorator at the Composition Root.
Why I Built Things-Kit: A Spring Boot Alternative for Go
The author explains how repetitive Go microservice setup led to Things-Kit, a modular framework on Uber Fx that packages configuration, logging, HTTP, database, cache, and lifecycle handling.
How To Implement a TypeScript Web App With Clean Architecture
The article explains how to structure a TypeScript web app with core, data, presentation, and DI layers so logic stays independent of frameworks, storage, and other details.
Dependency Inversion vs. Dependency Injection
The article distinguishes dependency inversion as a principle that favors abstractions over concrete implementations, and dependency injection as a pattern that supplies those dependencies at runtime.
Handling Dependency Injection in Inherited Classes
The post shows that constructor injection in a base class becomes tedious when new shared dependencies are added to every subclass, and proposes a dependency aggregate to centralize them.
The dangers and gotchas of using scoped services in IConfigureOptions
The post explains how ASP.NET Core options work, why `IOptions<>` and `IOptionsSnapshot<>` differ, and how scoped services can create captive dependencies when used in `IConfigureOptions<>`.
Dependency Injection in Elixir
The post compares two ways to apply dependency injection in Elixir: through application config with Application.get_env/3, or by passing collaborators as function parameters, with trade-offs in visibility and flexibility.
Creating Truly Modular Code with No Dependencies
The article argues that rising software complexity comes from dependencies between components, and proposes an element architecture that isolates logic through interfaces and listeners.
Angular 2 First App Post-Mortem
The author says Angular 2 is powerful but complex, with strong reactive programming support, improved dependency injection, and a promising router, while also noting tooling gaps, type-system limits, and a heavy payload.
Define multiple Angular apps in one page
The page shows that only one AngularJS app can be auto-bootstrapped per document and presents three ways to run two apps on the same page: manual bootstrapping both, bootstrapping only the second, or injecting both into a root app.
All About Angular 2.0
The article explains why Angular 2.0 was being designed, focusing on performance, the changing web, mobile, and easier use. It then outlines AtScript, dependency injection, templating, directives, databinding, and the router.
Dependency injection is not a virtue in Ruby
DHH argues that dependency injection is a Java habit that can be overvalued in Ruby. He says Ruby lets hard-coded references stay simple while still being easy to test, so language shape matters more than cross-language best practices.
