DI, dependency-injection, is a design pattern where dependencies (instances of objects, properties) of a component are set through the constructor(s), methods or fields (properties)

learn more… | top users | synonyms

3
votes
1answer
140 views

Dependency Injection & In-class Instantiation | Practical Limitations

Dependency Inversion is Good Inversion of dependency is good, it: Simplifies unit-testing Reduces coupling, allowing software components to be used interchangeably Keeps instantiation logic for a ...
0
votes
1answer
221 views

Data serialization architecture, injection on construction vs. on function call

I am creating a data serialization/deserialization mechanism for essentially a persistent storage object. Due to the variety of systems this mechanism could run on, there needs to be a a variable ...
2
votes
0answers
51 views

Merits of DI, Abstract Factory implementation review

I'm writing a brand new system and trying to stay true to the SOLID principles, specifically Interfacing and Dependency Injection. We are sticking closely to the Microsoft stack so we are using C# ...
2
votes
0answers
49 views

Mocking third party web service

I am working on a project to create a wrapper library which will be used to interact with a web service provided by the client's IT team. The reason for this library is that we interact with this ...
2
votes
0answers
242 views

State Pattern Code for embedded device - Dependency Injection of Device Objects in Context and State Classes

I'm wrestling with some code and I think I've finally gotten some state pattern code working with my events. I've got a simplified system that will work like this: This is my first go with State ...
2
votes
0answers
219 views

Manual dependency injection or abstract factory

We're starting to use dependency injection in a fairly large, interactive program. It's early yet, but I have a feeling that the majority of the objects being injected are going to want runtime data ...
1
vote
0answers
28 views

Dealing with stubbed external dependency

In sut I should I have two kinds of dependencies to be stubbed: 3rd party dependencies (mongodb & co) and own dependencies: var async = require('async'), // This dependency should not be stubbed ...
1
vote
0answers
240 views

Class Interfaces with Multiple Classes and Dependency Injection

NOTE ON QUESTION TITLE: I did not really even know how to phrase the title so if someone can edit and make it more articulate I would really appreciate it. QUESTION: Basically, what I'm trying to do ...
1
vote
0answers
63 views

How to clean composition root from anything other than object construction?

I'm doing poor man's DI (manual injection) in my application. My (pseudo-) composition root looks something like this: var connectionSettings = new Settings(SqlParameters) var dataLoader = new ...
1
vote
0answers
198 views

Am I following a good design thought process? Is the Abp framework overkill?

As I finish one project and start another, I have a small time window to come up with an architecture for the new. I am coming from the following design: Web applicationReceives domain models & ...
1
vote
0answers
1k views

Spring bean injection into a hibernate validator constraint

I have a controller method like listed below whose argument is annotated with @Valid to validate PasswordChange object using a Hibernate validator @Constraint. Both PasswordChange and a sample ...
1
vote
0answers
245 views

Single write, multiple read of stateful objects

Scenario: One data input feed (call this Source) Multiple objects (call these Layer1) read this Source, and analyze the feed. This analysis is stateful. Layer1 objects have configuration parameters. ...
1
vote
0answers
622 views

ASP.NET Mvc3 - application/request lifetime and dependency injection

I thought of asking on SO, but it seems this is more of a "concept" type question than a "problem" type question. If it needs to be moved, please do so. Anyway, I'm having a tough time finding ...
0
votes
0answers
41 views

Parameters from configuration files and dependency injection. What is the best way to combine them?

I am trying to figure out what is the best way to configure the services I want to be installed by the DI container. Imagine to have a configuration provider that abstracts over the configuration ...
0
votes
0answers
86 views

Is it possible to define injection rules based on Spring bean scopes?

My application is using Spring as my dependency injection framework. I have been struggling recently with nasty concurrency and security bugs. The bugs were caused by injecting bean with incorrect ...
0
votes
0answers
195 views

Dependency Injection with EF - is mapping required?

I'm implementing the Repository pattern with using DI and EF6. I created the database (that inherits from DbContext) object with the Visual Studio wizard ADO.NET Entity Data Model I have a generic ...
0
votes
0answers
609 views

Are prototype beans with constructor parameters an anti-pattern?

Reading on this, Misko Hevery has said “Newables can ask for other Newables in their constructor, but not for Injectables” Now it appears to me that requesting a prototype be instantiated at run-time ...