Design pattern to reduce coupling between components, by dynamically injecting into a software component dependencies that it needs to function.
8
votes
4answers
500 views
Finding the lowest and highest values in an array… with “Poor Man's DI”
I am practicing my object oriented knowledge, so I created a very simple program that determines which is the lowest and highest number inside array.
This is my main method:
...
3
votes
2answers
103 views
4
votes
0answers
44 views
Pool Checkers with AI
I recently added Pool Checkers to my Checkers game. My main concerns are about how I manage calling the correct variant in my PublicAPI functions. Because this is ...
0
votes
0answers
18 views
Move nodes if no veto from councilors
Working on a DTP based on Maven/Spring having a JTree(containing nodes as layers) try to implement a Authorithy for decide if layers can be droped to a target-layer....
23
votes
5answers
2k views
Extensible code to support different HR rules
Recently, I got challenged to code with following bullet points:
Extensible code to support different annual leave rules for HR departments
Maintainable code to add/change the existing rules ...
3
votes
2answers
100 views
Window Factory and Manager using MVVM pattern
I am fairly new to Factories and Dependency Injection in MVVM.
I've build my View(Window) factory with help from SO, and I would like to know if I had implemented everything properly(code works just ...
6
votes
1answer
99 views
Designing a toy dependency injection library
Just for learning purpose I thought to write a simple and useful dependency injection service which would just do dependency injection but also it should expose its core too which would let the client ...
3
votes
1answer
67 views
Managing documents with manager class
So I have a program that visualizes data from files (csv,txt,etc.). These files are saved to database as individual tables. In my application I have DocumentExplorer...
3
votes
2answers
112 views
Simple Python IoC
I'm looking into having a simple dependency injection container in Python. I've Googled on it but so far the solutions that I've found are quite huge and use constructs such as decorators and so on ...
4
votes
1answer
106 views
JSON loader with event bus, cache, and session
I have an Android application which needs to retrieve JSON files from a server and then display the information in my app. To accomplish this I have the following architecture:
The main activity adds ...
0
votes
0answers
102 views
Refactoring duplicate custom service configuration in .NET core
In my current .NET Core project, I want to inject two services into my controllers for dependency injection.
I wrote the following extension methods that each takes a ...
10
votes
1answer
298 views
Unit of Work (UoW) pattern with ADO.NET
I'm trying to implement the UoW pattern using ADO.NET and this is what I've achieved so far:
The IUnitOfWork Interface:
...
4
votes
1answer
60 views
IDTExtensibility2 implementation for Rubberduck's entry point
Here is the new & improved Rubberduck 2.x entry point class, based on MZ-Tools 8.0's Connect.VBA implementation of the ...
1
vote
0answers
42 views
Keep clean SimpleIoc initialization when reusing UserControl
Originally I had ChildUserControl inside ParentUserControl inside MainWindow with this view-...
3
votes
0answers
112 views
Factory (pattern) of Commands (pattern) with additional dependency injection (dependency inversion pattern)
What would you improve at the following code, except:
The problems I'm already aware of, marked as TODO
Line width of at most 120 characters (I've run flake8 over ...
4
votes
3answers
440 views
Dependency Inversion Principle and Dependency Injection in C#
I was doing some sample example which were perfectly fine. But, when I read about SOLID design principle, I had to change my code.
I have implemented DIP and DI (Constructor Injection) in my code. ...
2
votes
1answer
47 views
Pass logger dependency to PostSharp aspect
I'm trying to pass my logger to a Logging Aspect that I've created with PostSharp. I have one logger per job run (because I need to send each job's logs to different folders), each job runs in ...
2
votes
1answer
254 views
Implementation of a C++ IOC container
I have created a pretty simple IOC container for C++ that should allow me to write less coupled code in the future and make my code easier to unit test.
Overall I am fairly happy however I feel like ...
5
votes
1answer
98 views
UnitTesting with Mocking and Dependency Injection using Ninject
I have the following scenario that I have not come across so far using Ninject. I have the following class structure (simplified for easy of reading :]). First the abstract base class for all ...
0
votes
0answers
70 views
Inject a object with default properties using Ninject
I've introduced Ninject to an application, and want to understand if what we are running is as in line with best practice as can be.
I have a simple config which is required by a service. I want to ...
2
votes
0answers
32 views
Supporting all closure options in WinForms MVC application
I have a WinForms MVC application that uses Ninject for it's Dependency Injection (DI) / IoC Container. I have build quite a nice framework that allows the main shell (which uses a Docking Container ...
4
votes
0answers
86 views
“Ymbirtt vs The Gilded Rose” Kata
The Gilded Rose Kata is a refactoring challenge, in which some frankly disgusting code is thrown at the developer, and they're told to make a small change to it. For reference, the (truncated) ...
0
votes
0answers
704 views
Prism 6 Popup Window with EventAggregator to replace a service
I have a WPF project with Prism 6 and EF6. In my project I have a MainTabModule which has ...
2
votes
1answer
1k views
Injectable logging with NLog and Ninject
I have been using NLog for logging purposes in my web applications, but it was not injectable. More precisely, each class using logging declared the logger like this:
...
1
vote
0answers
279 views
MVC application internationalization using a database provider and dependency injection
Following Nadeem Afana's article about how to include internationalization into an MVC application, I have introduced i18n into one of my MVC applications.
These ...
2
votes
0answers
155 views
Tiny calculator using dependency injection and inversion of control
I've started to learn very interesting concept of DI, IoC and related stuff.
I have decided to learn it using simple application, very tiny calculator (only basic functions: add, subtract, multiply &...
1
vote
1answer
259 views
Dependency injection class in C++
In a recent project I started passing dependencies to classes as constructor arguments, instead of using local instances. This makes unit testing straightforward (with mock objects), but manual ...
3
votes
1answer
914 views
Use of Ninject as an IoC container in a WinForms MVC application
I am a relatively experienced WPF developer who has had good exposure to MVVM. I have been developing legacy WinForms applications for a while and have recently been asked to fully re-write a large ...
6
votes
2answers
211 views
Dependency problem in C#, through polymorphism, and appropriate design pattern
I'm currently working on a project which involves EntityFramework with a (very) rich model (lots of inheritance). I'm currently facing a problem, quite interesting in my opinion.
My model is ...
5
votes
0answers
576 views
Dependency injection with asp.net identity and property injection with dbcontext
I configure asp.net identity using Simple Injector
...
1
vote
2answers
131 views
Entity framework - code first data access
I'm looking for your opinions about ways to improve the access to data in my application. I develop web applications, using Entity Framework 6 code first, and Autofac for dependency injection.
Before ...
-1
votes
2answers
98 views
PHP Dependecy Injection Container
A few weeks ago, I asked for another DIC review, but didn't get any response (but only for one about my error handling). So I tried to rework my DIC without any outside insight on it, and the first ...
-1
votes
1answer
37 views
Listings Manager
I am trying to learn to code using Dependency Injection and Inversion of Control in Go.
Please consider the following code. I am basically creating an interface ...
2
votes
0answers
118 views
ASP.NET MVC with automatic testing (follow up)
This is a follow-up of this question regarding MVC application architecture fit for automatic testing.
I have rewritten the DI code based on the answer provided there and also created some tests to ...
1
vote
0answers
78 views
PHP Dependency Injection Container
I am currently working on a small framework and one of its main components is a dependency injection container I made. I am not a professional dev and I would like someone more experienced than I am ...
1
vote
1answer
402 views
ASP.NET MVC application architecture fit for unit testing with mocking
I am trying to learn how to professionally work with unit testing, so I have refactored a medium sized project of mine (a sort of article aggregator that also does some NLP processing) and tried to ...
2
votes
0answers
23 views
Return four spreadsheets of Google Analytics account, property, profile, and filter information
Scenario goes like this:
User enables plugin from within Google Spreadsheet
Authenticates with their Google Analytics Account
They select which accounts they'd like to perform an audit on
Four ...
4
votes
3answers
836 views
Unity Lazy Resolve Implementation
I have been using Microsoft.Unity as my container and have decided that the approach for a lazy implementation causes too much rework. Each time you decide to swap ...
1
vote
2answers
135 views
IoC.Resolve deep in the project or Constructor Injection on entry point of app
I'm building cross-platform application (every mobile/desktop OS + web in ASP.NET). I'm using Xamarin, so I can do everything in C#. But before I start working on UIs, I want to build soild, flexible ...
-2
votes
1answer
35 views
Dependency injection with glob
I have a folder called core with two files inside: index.js and module.js. I'm kidding a little with dependency injection and ES6, and I would like to receive feedback with improvements for my code.
...
1
vote
1answer
59 views
Application Configuration in PHP
I'm learning PHP and I know too many ways to configure the application.
I use this method:
Folder:
app
config
app.php
db.php
src
class.php
index.php
...
3
votes
1answer
357 views
Dependency injection with Factory pattern sample code
I'm trying to understand and learn about the SOLID principle and especially Dependency Injection (DI) and Factory pattern.
Some background:
I have a production application that uses some "helpers" ...
4
votes
1answer
84 views
Hashed texts based on user's passwords
I have finished my first project using ASP.NET MVC. I did not have to wait long to realise I have essentially violated all possible codes of good programming. Well, experience comes with practice.
...
8
votes
1answer
65 views
CommandBars, Buttons and Commands: Take 3
Following up on CommandBars, Buttons and Commands: Take 2, I've refactored quite a lot of the Rubberduck code base (like, a whole third of the entire code base has been affected), and successfully ...
3
votes
1answer
172 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
381 views
11
votes
1answer
427 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
710 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
189 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
128 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 ...