Object interfaces allow you to create code which specifies which methods a class must implement, without having to define how these methods are handled.

learn more… | top users | synonyms

1
vote
1answer
55 views

Optionally specifying the type when implementing a method for an interface [on hold]

These seem functionally identical: public class Temperature : IComparable<Temperature> { public int CompareTo(Temperature other) { } } as opposed ...
5
votes
2answers
43 views

Is it ok to add a static method to the IEqualityComparer implementation?

Linq methods like Distinct need IEqualityComparer object. But sometimes I just compares two objects and to create Comparer instance for that is seems redundant. So it would be nice to use static ...
5
votes
1answer
160 views

Drying Up Very Similar Implementations of an Interface

Work continues on the Rubberduck VBA Editor Add-in. I have a need to call some VBA code from the add-in with Application.Run. Unfortunately, the ...
0
votes
2answers
57 views

Would you utilise “Using” on a member which is going to be added to a list? [closed]

I have an interface and a concrete class which I am using in the code below: ...
10
votes
1answer
201 views

Inspector Rubberduck

Our Rubberduck open-source VBE add-in project is coming along nicely. One of the main features we're going to be implementing in the next release, is code inspections. I started by defining an ...
4
votes
1answer
31 views

Less insane interface design for a trigger component for T types?

Disclaimer: I just asked this on the regular SE, but was suggested to post it in here since it's kind of a code review. I've recently been playing around with component frameworks, and I'm trying to ...
7
votes
2answers
196 views

Abstract classes and interfaces in a game inventory system

After reading a lot about interfaces, which I'm new to, I've tried implementing it in my inventory system for a game I'm working on. I have managed to create something proof of concept which seems to ...
1
vote
2answers
58 views

Simple interface and class for holding text to be analyzed

I am making a sentiment analysis library targeted first at social media text (like Twitter) and then I will expand it for more general use. For the first step I am making a simple interface and a ...
2
votes
1answer
37 views

Implement interface type in implementation of another interface without too much casting

I have a group of tests that must be run in similar (but different) fashion and they have setups, results, etc. which are also similar but different. Great, I thought, I'll use interfaces to define ...
3
votes
2answers
146 views

Overly interfaced or not overly interfaced?

I have to take over an old project that was coded in VS 2010 C# 4.0 in 2012. Interface programming seems to be all over the place and over-applied to me, but I am unsure if it is that way. I need to ...
3
votes
1answer
115 views

Public interface for nearest neighbor data structures

I am making a small library of metric data structures. That is data structures, which associate points in the n-dimensional space with objects and allow the user to find objects which are closest to a ...
0
votes
2answers
53 views

Safe DbContext Disposal

I have a service class called ClientService, the service class is called using an interface IClientService. The service class ...
2
votes
2answers
65 views

Generic data interface

I currently have the following working code. I am looking for some suggestion with best practices and perhaps a better way to accomplish my goal. Goal: - in short - Have a generic data interface as ...
0
votes
1answer
77 views

Polymorphic template cloning class

I have a requirement of a templated clone() method which Base classes can implement through an ICloneable interface and all the ...
9
votes
2answers
136 views

PDO connection via INI parser classes

A few days ago I asked this question and I've got an answer to work with interfaces. I've tweaked around with this to get myself a INI parser class. ...
0
votes
1answer
86 views

Mapping interface between POJOs and DTOs

Following up on this question DTO interfaces for implementing web service integration I came up with this implementation. Data Transfer Object interface following a java.util.Map protocol. The ...
2
votes
1answer
70 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). ...
3
votes
1answer
125 views

DTO interfaces for implementing web service integration

I am trying to define some interfaces to implement some web service integration middleware. The SOA pattern that fits this system is probably the Multi-Channel Endpoint. I expect a lot of mapping of ...
4
votes
2answers
76 views

Create User profile with separate social media data

I am creating user profile logic for a blogging platform. I have the UserProfile model and then two separate models, ...
4
votes
1answer
51 views

Post Service Class

I have one entity that depends on another however in my API service class I would like to just deal with the dependent entity. Am I doing this correctly and is there a better way to go about this? ...
10
votes
1answer
151 views

Unit Testing in VBA

Unit testing in VBA is... lacking. (What isn't lacking in VBA though?) Since I've become more interested in unit testing lately, I decided I needed something better than ...
2
votes
1answer
89 views

Is my design achieving Separation of Concerns in this MVC implementation?

I've read lots about getters and setters being evil, unless there is good call for one, but I cannot figure out how to implement that knowledge into my Model layer. Say in my Model layer I have a ...
6
votes
1answer
60 views

UnitOfWork, an excuse for multiple repositories

I needed a way of attaching multiple repositories to a presenter. Given I already had an IRepository abstraction, coming up with an ...
2
votes
0answers
65 views

NodeJS, status propagation to interface

If you have an interface served by a NodeJS API, what is the most clean way to propagate status changes to the interface? For example, I have a page that has 2 statuses, user logged in and guest. How ...
11
votes
2answers
344 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 ...
11
votes
4answers
237 views

More German overengineering™ - Class mappings and factories

Goals: So the plan was simple: Provide a factory to instantiate implementations of a certain interface (ModelConverter<T>), depending on what model-class you ...
14
votes
4answers
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: ...
3
votes
2answers
195 views

Locate user of an Android device

I am new to oriented object paradigm and I work on Android using Java project for an internship. I must be able to locate the user and some around buildings I read stuff about how to setup ...
3
votes
1answer
67 views

Potentially superfluous iOS interface system

I have written an interface system for iOS that allows interface elements to be moved around on the screen as actors move around on stage. It can operate within a ...
1
vote
0answers
52 views

Is this interface structure/setup correct?

I'm working on wrapping the last.fm web API. I'm trying to use Interfaces to be able to easily make calls via functions which return an interface (as opposed to an object which would need to be ...
4
votes
2answers
112 views

User Authentication Bundle

I wrote a user authentication program(s) for an MVC application. Before you ask part of the project specs are I have to store user information in company databases on servers that aren't the web ...
2
votes
1answer
130 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 ...
3
votes
1answer
78 views

Loose coupling, accessing class properties

I'm trying to get a better understanding of decoupling methods. Right now, I have this method: ...
5
votes
2answers
92 views

When should I actually derive from my interface?

Context: I am working on an XNA project, and since procedural generation is likely to be used, I wanted to eventually create a helper class to work with data to facilitate that. Design Goal: ...
2
votes
1answer
78 views

Cleaning User Input

I am not sure if I am approaching this task the correct way. I have a view model with multiple string properties. I pass the model through an interface to a service class that contains a void to ...
10
votes
2answers
148 views

Functional interface hierarchy in Java 8

I just created the following code and am wondering whether it is logically correct (all other feedback is of course also welcome): ...
3
votes
1answer
67 views

How to provide best integrity for interfaces in C#?

I am trying to apply Interface principles into my code, learn by practice method. I have a CRM system that has Notes, Payments, DairyEvents and anything else that needs to be bolt on over time. I ...
5
votes
1answer
144 views

Interface for a tree node in Qt

I have the following C++ interface (in Qt) for a tree node, inspired somewhat by Valve's implementation of a culling octree: ...
12
votes
1answer
148 views

DataLayer Interfaces Genericized

I have some concerns on my refactoring for the data layer in my current Project. Just for a small info, I am currently building a CRM as "training JEE application". But enough of talk, let's talk ...
5
votes
1answer
55 views

Binary relation interface

I'm trying to design a binary relation interface in Java and then implement it, but I'm not sure if I'm doing it right. I'd really appreciate a little feedback just so I know if I'm way in the wrong ...
6
votes
2answers
1k 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: So first off I have my interface which defines what ...
4
votes
3answers
482 views
5
votes
1answer
250 views

How do I extract interfaces from existing similar classes?

I have about 11 singleton-esque classes divided over a dozen files: the first file is one that gathers all singleton definitions and makes them callable on a request scope: ...
7
votes
1answer
1k views

Variadic templates and pointers to member functions to achieve a named-parameters interface in C++

I studied a bit and packed all the suggestions that I received here: Fluent interface and polymorphism and I came up with this: ...
7
votes
6answers
846 views

Fluent interface and polymorphism

EDIT: For further improvements see the related question: Variadic templates and pointers to member functions to achieve a named-parameters interface in C++ I would like to improve the interfaces of ...
-1
votes
2answers
87 views

Interface of an authorization subsystem [closed]

I need to just design the interface of an authorization subsystem. This is what I have so far. What else would you suggest or change in the interface? For example, HR can see everyone but not their ...
2
votes
1answer
62 views

Backend interface VS hard contract

Here is an API for using a warehouse: ...
4
votes
1answer
120 views

Python model for a “snake”-like game

I wrote a python model for the game "snake" that I'm not really satisfied with. My intention was to separate the game logic from the drawing and input handling (which worked quite well) but I've got ...
2
votes
0answers
227 views

Interfaces and Classes between Projects

My application's structure looks like this: Solution: MySolution Projects in MySolution: Host, Business, Server. References between the projects looks like this: ...
1
vote
1answer
197 views

How to deal with interface inheritance and common properties? [closed]

I'm trying to design a generic caching system that takes keyed items and allows either read-only or read-write access to a cached version of it. The read-only backing interface is: ...