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

1
vote
1answer
261 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 ...
3
votes
0answers
70 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
60 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
251 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
226 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
31 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
254 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
68 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
213 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
248 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
638 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
25 views

How to setup dependency injection framework in JavaScript

I'm creating a web page and would like to keep the UI and the JavaScript separate. To accomplish that I'd like to add event listeners after the UI elements have been created. I don't know if this is ...
0
votes
0answers
45 views

Code Duplication After Dependency Injection Instead Of Inheritance

I'm applying Dependency Injection instead of Inheritance. But now, I've the problem of code duplication. Main Controller final class PreferenceController implements PreferenceInterface { ...
0
votes
0answers
24 views

Do you inject everything explicitly used in a module even if it is loaded in a “parent” module?

When you build a app modularized what do you inject into submodules? Only those things that are used there but not added at the top level, or do you inject everything that is explicitly used in that ...
0
votes
0answers
202 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
688 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 ...