Design pattern to reduce coupling between components, by dynamically injecting into a software component dependencies that it needs to function.

learn more… | top users | synonyms

3
votes
1answer
64 views

Configuring MVC 5 project with service layer and DI and UOW

In the past I have always called the repositories directly from the controller, but that is a bad practice and now I am implementing a "Business Layer" to my project. Would I have two UnitOfWorks? ...
3
votes
1answer
77 views

Web job logger implementation

Interface for logger: ...
11
votes
1answer
96 views

IoC Registration: Convention over Configuration

The rubberduck project has reached a turning point. The core features are implemented (except the SmartIndenter embedding - we're keeping that for 2.0), the next few releases will probably just build ...
3
votes
1answer
159 views

PHP class architecture and dependency injection

Let me start off by saying I am not new to PHP or PDO, but very new to OO PHP, and have been struggling to get a firm idea of best practices in my head regarding dependency injection and structuring ...
5
votes
2answers
134 views

Generic Networking Class for PHP

I am in the process of writing networking code for PHP that is meant to be used in long-running PHP processes. I realize that PHP is supposedly not well suited for long-running processes, however ...
2
votes
1answer
93 views

Ball Entity for a Entity/Component/System Soccer Game - Revision 1

I made some refactorings in my classes. The original code is in this question. In that question I receive the suggestion to create a Factory for the class BallEntity. I myself forgot that BallEntity ...
3
votes
1answer
108 views

Safely storing Azure Topic clients in concurreny dictionary

I am trying to optimize the usage of TopicClients in my app. The instance is originally covered by interface and passed by IoC, so the IoC will dispose it at the end of the program life cycle. This ...
2
votes
0answers
50 views

Abstract DI Container Scopes

I'm in the process of refactoring one of my open source projects, branch here. The basic idea of the refactor is to allow for classes and all of its children in the graph to be scoped. I wrote a blog ...
1
vote
1answer
64 views

Creating various types of menus using dependency injection

I am here to discuss what are the possible improvement can be made in order to make the following code covering all the principles of programming paradigm ( SOLID , DRY ...etc ). Basically, I am ...
5
votes
2answers
112 views

“CommandBus” with Handlers & Observers

I'm looking for a very simple (at first sight) CommandBus, which will handle some ICommand publication. The ...
2
votes
1answer
37 views

Dependency Injection with classes which are created often

I have a question about dependency injection and best practices when using simple classes which are meant to be created often, which have dependencies on external services. Here's a (vastly) ...
0
votes
1answer
90 views

Dependency injection with reading a file

I implemented this code, looking at a dependency injection program as an example. I wanted to confirm with you all whether this implementation is the right way of doing the same. ...
1
vote
1answer
44 views

Manager for customer billing and subscriptions in Rails

I'm looking to get rid of a couple dependencies that I have a sneaking suspicion are present in the code that I'm writing. Right now I have a service class that manages my subscriptions for part of ...
0
votes
1answer
31 views

updateBuildChart method with a lot of dependencies

I've some refactoring issue with one method. This method has a lot of dependencies ...
5
votes
1answer
127 views

Unity and an IoC for Settings

After a somewhat lengthily discussion in the chat room, I have set up an IoC container with Unity to store my settings in. This is my static IoC class: ...
0
votes
1answer
258 views

Having a static com.google.inject.Injector

Dependencies: ...
6
votes
1answer
123 views

Allowing query handlers to use other query handlers

I recently started looking into CQRS when using Entity Framework and the impact it has had on my systems has been overwhelming. I implemented the following patterns described in these blog posts: ...
3
votes
1answer
54 views

MS VS solution structure w.r.t. dependency injection unit tests?

Is the following MS VS solution structure and classes OK w.r.t. easy unit tests with dependency injection? Would your unit tests look similar? If you call the calculations below over a WPF module, ...
6
votes
2answers
1k views

ViewModel creator design

I am trying to move some logic outside my controller for creating my view models for the view. I have a lot of queries to fire to make sure the complete view model is ready, so to keep my ...
2
votes
1answer
116 views

Vehicle Running Cost calculator

I'm making a road tax data calculator/parser for practice. I do this because I want to learn more about OOP and arrays with its functionality. On my previous post, i made this same application but ...
1
vote
1answer
39 views

Managing a collection of object instances and getting them back out with instance manager / service locator

I'm creating an event loop for an asynchronous event execution library for PHP in PHP. Note that this is for a library and not an application. My event loop is just that -- a simple event loop that ...
1
vote
1answer
378 views

Dependency Injection With Unity in MVC 5 without repository and unit of work

I want to use dependency injection with Unity in my application. I am not following repository pattern and unit-of-work (and don't want to). I also have ViewModel in my controller action method. ...
2
votes
1answer
65 views

Road tax data parser

I'm making a data parser for road tax data (costs) which parses a JSON file with all weird variable names, which the customer gave me. The costs are different on each vehicle type. The costs at some ...
5
votes
2answers
468 views

Abstracting a Password Service

I want to use Microsoft.AspNet.Identity's PasswordHasher but I don't want to pollute my Domain layer with knowledge of it. As ...
1
vote
0answers
59 views

OOP QueryHandler in PHP

I have a simple database connection class which is using PDO: ...
3
votes
2answers
59 views

Creating list ViewModels in the correct way

I'm using Caliburn Micro to create a WPF application. So what I want to do here is a typical Master/Detail situation. I'm displaying a list of Users and you can can add/edit a User and save the ...
3
votes
1answer
124 views

Game stats storage / display

I have a simple game where you try to go as high up with rockets as possible. I currently store 2 statistics about your playthrough: Current altitude Highest altitude These statistics are stored ...
1
vote
1answer
83 views

Factory object with a dependency on a bean

My problem is quite straightforward. I want to build a factory, but the kind of object returned depends on a value read from a bean that is somehow a cache. So of course, I can't call the bean's ...
0
votes
2answers
110 views

Dynamic connections classes

I have an abstract Connection class which looks like this: ...
5
votes
1answer
114 views

Autowiring publishers/listeners with reflection in Unity Framework

I'm currently building an application with the Microsoft Unity Framework. I also use a simple system of message publishers/listeners inspired from MVVM light and caliburn: The listener interface ...
2
votes
0answers
36 views

Injecting required functions by synchronous script loading

I have a file HintBox.js containing a JS prototype of the same name which requires our internal JS library (call it $lib) in ...
3
votes
1answer
879 views

Dependency Injection into an Abstract Class

Me and another developer have recently forked and taken over an abandoned, open-source project. I have also been reading articles and watching videos by Misko Hevery. When I was reading through the ...
3
votes
1answer
349 views

Implementing ViewModel design pattern using DI in a MVP-VM architecture

Based on this answer: MVVM implementation using C# and XAML, I understand that my ViewModel is some kind of a wrapper for my Model. Being a fan of DI and SOLID principles, I have made my ViewModel ...
2
votes
1answer
126 views

What could be bad from using this form of dependancy injection?

I have a custom framework that I am not sure if certain things I have applied are wrong and if so, just why. I am not well versed in any framework, so I was forced to use mine. Here is an example ...
4
votes
2answers
4k views

Unit of work + repository + service layer with dependency injection

I am designing a web application and a windows service and want to use the unit of work + repository layer in conjunction with a service layer, and I am having some trouble putting it all together so ...
3
votes
1answer
310 views

Unit/integration tests

Here's what I got: ...
4
votes
1answer
110 views

Properly using parameterized Factory.Create() method using DI

My factory is using method injection because I thought this was the best way to make it so far. Besides, I doubt it is a good thing after having to call on its ...
1
vote
1answer
220 views

RouteContext as constructor parameter or method parameter in ASP.NET vNext

I have this simple class where I load an object from the database and store it into the RouteContext.DataTokens because I need to access it through out the request. ...
4
votes
2answers
212 views

Is it a good practice to use only one database instance?

I want to ask whether is good practice to have single instance of database connection or declare new every times when we needed? I have this two designs shown in below: This is database class: ...
1
vote
3answers
133 views

Dependency injection/dependency injection containers in MVC web app

I just learned about dependency injection/dependency injection containers, and I realize that the controller in my MVC web application is hard to test. My original controller class: ...
8
votes
2answers
129 views

Down the rabbit hole with MVP

Following-up on this post where I implemented a Repository Pattern in vba to abstract ADODB and enable testing my Excel app without hitting a database backend; curious about how far vba would let me ...
10
votes
2answers
174 views

YARPI: Yet Another Repository Pattern Implementation

Following-up on this post, I wanted to be able to put a copy of that Excel workbook on a USB key and take it home to keep working on the code a bit (there's more than just one or two tables to ...
10
votes
2answers
3k views

Do I need ninject when implementing DAL with generic repository and unit of work?

I am implementing generic repository and unit of work for the first time. I would be glad if someone can correct me if I am doing something wrong here. This is how I communicate with my DAL from ...
6
votes
1answer
5k views

Autofac DI container in console app

Just used DI containers in MVC projects, via constructor injection, and I'd need to now inject a service into a console app. I'm using Autofac so I followed what I found here. The code would be ...
0
votes
1answer
399 views

Unity DI Composition Root vs XML [closed]

I'm having trouble figuring out the best approach with DI. After doing more research, Mark Seeman recommends using the Composition Root approach. In my example, I am using XML configuration to design ...
2
votes
1answer
980 views

Laravel - lots of dependency injection

I have the following UserServiceProvider and I'm wondering whether so much dependency injection is overkill: ...
2
votes
1answer
185 views

Calling a copy constructor in Presenter to prepare a list of Models

I'm new to MVP. In a presenter I have following code. Here what am I trying is to create a list of Model objects (in this case ...
6
votes
2answers
790 views

Will this Circuit Breaker catch fire?

I was going to post this code as an answer to a recent question, but I wrote this code a little while ago (like, a year ago; if I recall correctly I wrote this after reading this article) and I'd like ...
4
votes
1answer
74 views

Using a UserPermissionService by all Presenters in the Application to control the access to commands

I'm handling user permission in a MVP Winforms application as follows. Here I'll give a full detail of my code as it will be helpful when answering to this question. My user model has a list called ...
1
vote
1answer
67 views

Inheritance or DI in Presenter classes in MVP [closed]

In MVP pattern we can use DI when our presenter classes need services as follows: ...