All Questions
16
questions
0
votes
3
answers
251
views
Using "Generics" to implement "Unit Of Work"
I need to design a generic "Unit Of Work", basically so that I can "change the context of the Database" only changing the implementation of ...
5
votes
1
answer
202
views
Service for generating faked objects
I'm using the Bogus library to mock up some data for testing.
This is my main method demonstrating how the faking service should be used:
...
2
votes
1
answer
460
views
Handling related generic type parameters
In answering a question on StackOverflow, it occurred to me that a more generic version of GroupBy for C# that delegated membership in each group to a class could ...
0
votes
1
answer
87
views
Using a wrapper on a primitive as a generic for an interface used for Java lambda
I apologize for that title, lol.
I have a Java method that I'm writing where I want to be able to pass in an array of Objects and two interfaces that will be used for lambda expressions that specify ...
2
votes
1
answer
3k
views
Implementation of generic unordered list in java
This question is a follow-up question of this question. These features are added to the new class -
Generic class
User is capable of setting the size
...
5
votes
1
answer
2k
views
Processor for handling generic commands
I'm trying to implement business logic layer based on concepts of commands and command handlers.
A command is a thing that contains input parameters for executing some action, and it knows what kind ...
9
votes
5
answers
658
views
Declarative type comparer
Writing comparers by either implementing the IEqualityComparer<T> or the IEquatable<T> interface is another boring ...
3
votes
1
answer
88
views
Validation rules with support for immediate termination of processing
I am picking up a code smell from this code and I am not sure of the best way to rid myself of it.
I have a validation class that has a function that returns a list of ...
1
vote
1
answer
2k
views
Initializing local variable to generic interface
Below is my working code written as an exercise in wildcards in generics and Java 8 type inference. My question will be about the commented line in union() method. ...
1
vote
1
answer
6k
views
Creating a Generic Template Interface/Class and injecting into another object
I would like to create a generic template class for my document processor. Assuming the template has a source file path and a "content", here's what I came up with:
Template
...
3
votes
1
answer
114
views
Functional interface uses uncheck or unsafe operations
First of all, I am absolutely surprised that this code even works. Originally what I did was create a version checking system for Minecraft plugins (specifically Bukkit, Craftbukkit, & Spigot).
...
12
votes
2
answers
3k
views
Instantiating a run-time implementation of an interface
Below is my code that was written for the following task (based on an SO question):
Given a Java Collection (of N elements) create an ...
14
votes
4
answers
2k
views
Reusability vs simplicity in a small game with a set of interfaces
I have a small game I'm working on with a set of interfaces:
IHavePosition:
...
2
votes
1
answer
198
views
Many interfaces and lots of inheritance vs few interfaces and less inheritance? [closed]
I have a Visual Studio Solution which has a bunch of Projects in it. One of these projects is called "Services" and is basically the junction point between all remaining projects. When I built it ...
11
votes
2
answers
11k
views
Empty Interface usage - Is this a code smell?
I've recently made a set of interfaces/classes to work with converting a spreadsheet into an object but I utilise an empty interface in my design:
I have my interface which defines what a spreadsheet ...