0
votes
2answers
134 views

Is using interfaces on internal code a good idea? [duplicate]

I'm working on a set of automated tests that we use internally at work. Lately, we've been designing classes that implement interfaces in addition to inheritance. As I understand it, interfaces in ...
1
vote
1answer
158 views

Should I use inheritance or an interface?

So in a nutshell I have an abstract class : public abstract class Member { public string PCode { get; set; } public string Reference { get; set; } public DateTime? ElectedDate { get; set; } } And ...
4
votes
5answers
218 views

Loose coupling and shuffling dependencies

I have a bunch of classes that look something like this: public class MyGame() { private Graphics graphics; private Player player; public MyGame() { graphics = new ...
5
votes
3answers
278 views

Interface at the class or function level?

I have been falling into a pattern lately where I have been defining routines that rely on an interface defined by a function that is specified as a parameter to the routine. (The language is C#, but ...
2
votes
6answers
2k views

Design Patterns - Why the need for interfaces?

OK. I am learning design patterns. Every time I see someone code an example of a design pattern they use interfaces. Here is an example: ...
2
votes
3answers
168 views

Is it good practice to not filter values according to nullability?

Sometimes when I create an API that should enable getting a single value or all values I use the following pattern (passing NULL to the API, means get all rows): @Usernames - comma separeted list of ...
0
votes
0answers
152 views

Pattern or solution for using classes with different interface the same way

What I would like to achieve is to use classes (now two, later more) with different interface the same way, so I would like avoid using decisions based on the interface on upper levels for instance, I ...
1
vote
4answers
520 views

Explanation of the definition of interface inheritance as described in GoF book

I am reading the first chapter of the Gof book. Section 1.6 discusses about class vs interface inheritance: Class versus Interface Inheritance It's important to understand the difference between ...
2
votes
1answer
278 views

How does dependency inversion principle work in languages without interfaces?

In C#/Java, the dependency inversion principle is often demonstrated by high-level classes that depends on an interface/abstraction (that it owns). Low-level classes will implement the interface, thus ...
1
vote
4answers
449 views

Switch interface implementation using configuration [closed]

We want to allow the same core service to be either fully implemented or, as other option, to be a proxy toward a client legacy system (via a WSDL for example). In that way, we have both ...
1
vote
2answers
789 views

Adhering to a protocol and being a subclass at the same time?

In objective C, I have a situation where I would like to have an abstract protocol (interface) with 5 methods and 4 properties, but at the same time, I'd like to have a common implementation of 3 of ...
9
votes
7answers
2k views

Interfaces on an abstract class

My coworker and I have different opinions on the relationship between base classes and interfaces. I'm of the belief that a class should not implement an interface unless that class can be used when ...
64
votes
13answers
16k views

Do I need to use an interface when only one class will ever implement it?

Isn't the whole point of an interface to for multiple classes to adhere to a set of rules and implementations?
7
votes
9answers
1k views

What OO Design to use ( is there a Design Pattern )?

I have two objects that represent a 'Bar/Club' ( a place where you drink/socialise). In one scenario I need the bar name, address, distance, slogon In another scenario I need the bar name, address, ...
0
votes
1answer
169 views

The design of a generic data synchronizer, or, an [object] that does [actions] with the aid of [helpers]

I'd like to create a generic data-source "synchronizer," where data-source "types" may include MySQL databases, Google Spreadsheets documents, CSV files, among others. I've been trying to figure out ...
3
votes
4answers
299 views

As a tooling/automation developer, can I be making better use of OOP?

My time as a developer (~8 yrs) has been spent creating tooling/automation of one sort or another. The tools I develop usually interface with one or more API's. These API's could be win32, WMI, ...
0
votes
1answer
580 views

Building a table (DataGridView) while keeping decoupled from Model

I'll try to keep this simple. Small C# app, dialog based, one has a DataGridView. I've got an UpdateTable function in the form that accepts a DataSet and passes it to the DataGridView.DataSource. ...
12
votes
5answers
9k views

Model-View-Presenter implementation thoughts

I'm trying to get a good grasp of how to implement good decoupling between a UI and the model, but I'm having trouble figuring out exactly where to divide the lines. I've been looking at ...
9
votes
5answers
1k views

Modified Strategy Design Pattern

I've started looking into Design Patterns recently, and one thing I'm coding would suit the Strategy pattern perfectly, except for one small difference. Essentially, some (but not all) of my ...
2
votes
7answers
1k views

Architectural patterns for interaction beyond MVC? [closed]

We all know the venerable Model-View-Controller pattern used to design interaction [mostly] with human users. It is the de-facto standard in OOP environment. What are some other architectural ...