Questions about interface related design considerations, such as programming to the interface.

learn more… | top users | synonyms (1)

9
votes
4answers
876 views

Is it bad practice to use an interface for categorization only?

For example: Say I have classes A, B, C. I have two interfaces, lets call them IAnimal and IDog. IDog inherits from IAnimal. A and B are IDogs, while C is not, but it is an IAnimal. The important ...
8
votes
4answers
3k views

Return interface or class

Suppose I have a method public List<User> GetBatchOfUsers(IEnumerable<int> userIDs) { List<User> users = new List<User>(); // some database stuff return users; } ...
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 ...
4
votes
2answers
542 views

Storing IEnumerable as instance variable - is it a code smell to expect it to change?

I have something that works like a fixed size list - it's actually called FixedSizeStack<T> in my program. I will use it to represent the X last occured events. This event list will then be ...
8
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, ...
1
vote
1answer
192 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 ...
5
votes
4answers
369 views

Passing compound object for parameters

I have different data modules, which take a couple of parameters from a configuration list. Do you think it's ok to pass a configuration object as a whole module1(config) and let the module pick what ...
3
votes
2answers
266 views

Is this a pattern? Proxy/delegation of interface to existing concrete implementation

I occasionally write code like this when I want to replace small parts of an existing implementation: public interface IFoo { void Bar(); } public class Foo : IFoo { public void Bar() { ...
3
votes
2answers
964 views

Is it a good programming practice to have a class with several .h files?

I suppose the class have several different interfaces. Some it shows to some class, some it shows to other classes. Are there any good reason for that? One thing I can think of is with one .h per ...
16
votes
10answers
12k views

Why use an interface when the class can directly implement the functions? [duplicate]

Possible Duplicate: Why are interfaces useful? Like most faculty, my java faculty introduced interface without explaining or even mentioning its practical use. Now I imagine interfaces have ...
3
votes
4answers
1k views

How can I explain C# interfaces, and constructors to a 8 years old kid?

How can I explain C# interfaces and constructors to a 8 years old genius kid?
6
votes
3answers
906 views

Checking preconditions or not

I've been wanting to find a solid answer to the question of whether or not to have runtime checks to validate input for the purposes of ensuring a client has stuck to their end of the agreement in ...
1
vote
6answers
421 views

Interfaces: profit of using

First of all, my ubiquitous language is PHP, and I'm thinking about learning Java. So let me split my question on two closely related parts. Here goes the first part. Say I have a domain-model ...
1
vote
4answers
2k views

Teaching java interfaces to absolute beginners: What is a good example? [duplicate]

Possible Duplicate: Explaining interfaces to beginning programmers? I searched on stackoverflow and here for a good example to teach java interfaces in a beginners class. I found the ...
14
votes
5answers
2k views

How do you evolve & version an interface?

Say you have an interface IFoo: public interface IFoo { void Bar(string s); int Quux(object o); } In version 2 of your API, you need to add a method Glarg to this interface. How do you do ...
0
votes
2answers
498 views

Is this bad design for a Shape interface?

I'm creating a vector editing program in C++, and I need a Shape interface which other concrete classes will implement. There is a requirement that no implementation inheritance is allowed. The design ...
9
votes
5answers
3k views

Interface and Inheritance: Best of both worlds?

I 'discovered' interfaces and I started to love them. The beauty of an interface is that it is a contract, and any object that fulfills that contract can be used wherever that interface is required. ...
4
votes
1answer
2k views

implicit vs explicit interfaces

I think I understand the actual limitations of compile-time polymorphism and run-time polymorphism. But what are the conceptual differences between explicit interfaces (run-time polymorphism. ie ...
0
votes
5answers
2k views

Why does the use of interface-based programming appear to be limited to behaviour?

I have been doing a little thinking about inheritance vs. realization vs. composition. I am not about to post the whole detail here. So I was wondering, when we are not talking about creating ...
12
votes
8answers
7k views

What is the point of an interface? [duplicate]

Possible Duplicate: When to use abstract classes instead of interfaces and extension methods in C#? What other reasons are there to write interfaces rather than abstract classes? This ...
6
votes
1answer
134 views

Private interfaces within a package

This is basically the same as Coding to interfaces, but played out in the real world of com when there are various engineering complexities such as immutability of published interfaces and ...
1
vote
2answers
2k views

What other reasons are there to write interfaces rather than abstract classes? [duplicate]

Possible Duplicate: When to use abstract classes instead of interfaces and extension methods in C#? When I read and looked at codes using Abstract classes, I was able to justify it because ...
10
votes
3answers
752 views

How do existential types differ from interfaces?

Given the existential type T = ∃X.{op₁:X, op₂:X→boolean} and this generic Java interface: interface T<X> { X op₁(); boolean op₂(X something); } What are the fundamental differences ...
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 ...
3
votes
3answers
344 views

Naming conventions for the only envisioned implementation of an interface

If you decide "Program to An Interface" trumps YAGNI and decide to create a supertype where you don't envision anything other than one obvious implementation - is there a convention for naming the ...
5
votes
3answers
324 views

Should I provide synonyms in an API?

I'm designing a small library and there is a strong temptation to provide synonyms to some of the exported functions. var foldl = function(){ ... }; var reduce = foldl; //reduce is a synonym for ...
2
votes
5answers
614 views

Design Methodology for Developing Interoperable Systems?

A bit of background The company I work for has been creating database applications since around 1980 and, until relatively recently, most of these systems have been stand-alone "silo" systems. ...
1
vote
2answers
217 views

How is this “interface”-like structure/pattern called? [closed]

Let's assume we have an XmlDoc class that contains basic functionality for dealing with an XML data structure and saving/loading data to/from a file. Now we have several subclasses, A, B and C. They ...
9
votes
4answers
340 views

Are interfaces and method signatures copyright protected?

For example, is it copyright infringement if I write a class called Random with the exact same purpose and method signatures as Microsoft's .Net System.Random class? Does it make a difference what ...
1
vote
1answer
276 views

What's the best way to use a kinect with multiple software music synthesizers?

For the past few months I've been looking into developing a Kinect based multitouch interface for a variety of software music synthesizers. The overall strategy I've come up with is to create ...
5
votes
2answers
4k views

What is the proper way to implement the OnClickListener interface for many buttons

My Android Activity contains multiple buttons that all need an OnClickListener. I've seen lots of different ways of doing this such as:: Implementing the interface in activity class Creating a ...
2
votes
3answers
2k views

Why should I use interfaces if the implementation will mostly stay the same? [duplicate]

Possible Duplicate: Why are interfaces useful? In our company we have a service oriented architecture in our asp.net application. We use interfaces for every crap class. Its a huge ...
8
votes
11answers
752 views

Why do interfaces require methods over members?

...As this forces us to create getters and setters, which in practice are often totally extraneous? Is there any good language-design reason why interfaces in most (all?) languages do not allow member ...
4
votes
9answers
805 views

Does single inheritance limit what we can do with generalisation?

As a rule of thumb, generalisation is used only in specific circumstances. For example, when we can say that X is literally a subclass of Y. So, we can happily say that a Horse is a subclass of ...
37
votes
11answers
3k views

Is it bad habit not using interfaces? [closed]

I use interfaces rarely and find them common in others code. Also I create sub and super classes (while creating my own classes) rarely in my code. Is it a bad thing? Would you suggest changing ...
11
votes
6answers
972 views

How to implement only a part of an interface

When developing in OOP, sometimes an interface / contract is given by a library that you cannot alter. Let's call this interface J. Now you have an object of class A that consumes objects that ...
0
votes
1answer
623 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. ...
16
votes
4answers
11k 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 ...
17
votes
3answers
1k views

Would adding award points or game features to workplace software be viewed poorly amongst the programming community?

So one of my responsibilities at work is to build an internal tool that helps the workers enter in all their information. It's an enterprise application that is similar to a Windows forms database ...
5
votes
3answers
3k views

What can I use instead of Interfaces in Ruby (or any other dynamic language)?

My goal is to define contracts between classes. I like duck typing and all but I'd like also to define an interface between different layers of my application to clearly define which are the method ...
1
vote
11answers
252 views

Consistency of an object

I tend to keep my objects consistent during their lifetime. In some cases, setting up an object requires multiple calls to different routines. For example, a connection object may operate in this way: ...
5
votes
3answers
862 views

How do Text User Interfaces (TUI) work?

Hello I have recently been assigned to port and old cobol programm. I am used to GUI and it i cant understand how TUI work!! I searched a lot through google but could find something.... I knew that ...
7
votes
6answers
391 views

What core principles would you want in a library?

Theres talk about what syntax and feature you like in a programming language; i'll now ask what core principles or feature would you like in a library in your favorite (or any) language? An example ...