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

0
votes
1answer
60 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
27 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 ...
-1
votes
0answers
19 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
59 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: ...
3
votes
1answer
63 views

Is it okay for my 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: ...
2
votes
0answers
41 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, ...
5
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 ...
-1
votes
1answer
72 views

DDD and Dependency Injection a smell or common [closed]

I am working on a little something to build up my understanding of DDD. Those of you who are familiar with the game Fantasy Premier League will perhaps understand my dilemma or even maybe inform me I ...
2
votes
1answer
107 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
38 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
227 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
418 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
56 views

OOP QueryHandler in PHP

I have a simple database connection class which is using PDO: ...
3
votes
2answers
55 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
105 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
2answers
80 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
84 views

Dynamic connections classes

I have an abstract Connection class which looks like this: ...
5
votes
1answer
95 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
33 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 ...
4
votes
1answer
466 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
287 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
119 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
2k 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
300 views

Unit/integration tests

Here's what I got: ...
4
votes
1answer
93 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
150 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
126 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
121 views

Dependency injection/dependency injection containers in MVC web app

I just learned about dependency injection/dependency injection containers, so this is my test using DI/DIC in my MVC app. Controller ...
8
votes
2answers
108 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
151 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
2k 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 ...
4
votes
1answer
3k 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
310 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
855 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
168 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
597 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
70 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
61 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: ...
7
votes
3answers
403 views

VB6/VBA Declaration (Dim) Syntax Parser

As part of a project I'm working on, I've implemented a class that encapsulates the syntax for a vb6/vba Dim statement. Given a line of code, the ...
3
votes
0answers
231 views

Building a console application using a DI service container

I am working on a project that will allow developers to create a console application using a dependency injection service container. Both the console and container are Symfony components with some ...
3
votes
1answer
161 views

MVP win forms application

In a module of a win forms application I have a hierarchy of classes like BaseRecovery, LoanRecovery and ...
1
vote
1answer
1k views

Async Log4net logging handler - High CPU usage on async call

I've got a LoggingMessageHandler that incoming requests on my WebApi application filter through. ...
5
votes
2answers
320 views

Gift aid calculator task

I have recently taken a small technical test in C# and the following were expected: All stories to be completed with an appropriate level of testing. No actual database implementation is required, ...
1
vote
2answers
286 views

MVP Pattern used in a payroll solution

I'm using MVP pattern for a payroll system as my final year project. There are about 16 entity classes (like employee, client, ...
3
votes
3answers
638 views

Using Poor Man's DI to inject helper class dependencies

I had a rather large method in one public class that I refactored into 2 helper classes. The thing is though, that those 2 helper classes have dependencies. I refactored them into helper classes so I ...
8
votes
3answers
440 views

Refactoring method to make it unit testing friendly

I have a completed application which I'm trying to write unit tests for (Yeah I know, talk about bad practices) I have the following class here ...
2
votes
0answers
698 views

Generic Repository, UnitOfWork and IOC container

I am stuck to define a generic repository with AutoFac IOC container. I am keeping thing very simple and only showing relevent information. I have a BaseEntity ...
1
vote
0answers
77 views

Split large import task into smaller subtasks

I have a large import task that runs as a cronjob and I want to split that task in smaller subtasks. Each subtask should be handled by an own class. At the cronjob entry point I prepare the ...
3
votes
1answer
167 views

Going from Spaghetti PHP OOP to SOLID OOP

I am beyond stuck in a half way point between PHP structural and OOP, but I can never achieve proper SOLID patterns despite reading DI, IOC, and reading about the interfaces. Rather than to read ...