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
0answers
6 views

ASP.NET N-Tier application dependencies [closed]

I'm creating an ASP MVC application and I worrying that my dependencies flow is currently incorrect. I would like a second opinion. I have 4 projects in my solution. Business Logic (takes a ...
2
votes
0answers
36 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
66 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
102 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
36 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
162 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
64 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
393 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
50 views

OOP QueryHandler in PHP

I have a simple database connection class which is using PDO: ...
3
votes
2answers
50 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
96 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
77 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
74 views

Dynamic connections classes

I have an abstract Connection class which looks like this: ...
0
votes
0answers
42 views

PHP Dependency Injection - magic methods injections?

I'm trying to get my head around DI. Am I doing it correctly for classes that follow DI pattern? ...
5
votes
1answer
83 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
114 views

Unity Dependency Injection [closed]

This is my first time using Unity so bear with me for a moment. I have a sample Visual Studio 2012 solution with 4 projects (but only two of these projects will be used with Unity). This is the ...
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
323 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
237 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
118 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 ...
3
votes
2answers
1k 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
298 views

Unit/integration tests

Here's what I got: ...
4
votes
1answer
86 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
127 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
107 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
112 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
102 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
144 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
2k 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
250 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
769 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
146 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
496 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 ...
3
votes
0answers
60 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
56 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
353 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
210 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
138 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
280 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
253 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
560 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
384 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
630 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
73 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
162 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 ...
10
votes
1answer
226 views

Should a Factory ever be generated per request?

I'm working with AutoFac to do some DI. I think I've got a decent grip on things, but just ran into a question I had with my code and thought I'd check: ...
3
votes
2answers
79 views

Dependency on overridden method

In my code I have a base type which is OnlinePaymentTransaction: ...