1
vote
1answer
105 views

Code review for an abstract repository implementation

I have a repository abstract class that encapsulates pretty much all of the CRUD functionality: public abstract class DataRepository<T> : IRepository<T> where T : class { public ...
4
votes
1answer
144 views

How do I make this code unit-testable?

I have a functionality that imports data into a database, based on an Excel workbook and some meta data (both user-supplied). The functionality implements interface IFunctionality which essentially ...
1
vote
3answers
86 views

Improving Javascript code of a failed test

I just failed in a JavaScript test and I would really appreciate some comments of how I can improve so I can keep learning. The test was about making a form interactive, where the code should do ...
2
votes
1answer
137 views

Am I using Golang concurrency correctly to increase reliability?

This code takes text from the standard input, maps it to a struct (if possible), and creates a JSON string from that. I'm using a barcode scanner for the input, and I've attempted to use goroutines ...
0
votes
2answers
77 views

Repetitive code for different Database Entities with same implementation

I have this code in LogInService public User isValid(User user) { if(user == null) return user; User db_user = userDao.getUserByUsername(user.getUsername()); if ...
1
vote
4answers
194 views

Java using instanceof operator for this example

I am developing a BlackJack game using Java, and it came to a point that I am using instanceof operator to determine if it is a type of some subclass. Here's an example. public void ...
5
votes
1answer
104 views

Please review following code

Please review the following code. Methods getFirsts and getSeconds return a list of objects which implement CommonInterface and both of them are private. Is it a good or bad design. @Override public ...
4
votes
2answers
167 views

Is this C game code OK? Structures and bitfield flags with some macros to handle them

I wrote some C code for working with some data for a game, I wanted to know what do you think and what could I do to improve it, what should I change, etc. These are just some lines of the file, you ...
1
vote
2answers
261 views

How to remove duplicate code in these two very similar Java classes?

I have two Java classes with very similar code. Basically they are almost the same excpept for a few method calls etc, i.e. replace 'ip' with 'msisdn' in the classes and they would be identical. I'm ...
3
votes
4answers
377 views

Extremely long if-or-or statement just feel wrong

I'm sure this is wrong, but I can't think of a cleaner way to do this. I'm looping through a set of column to identify which column identifies the company name, the test is true if one of a large ...