interface

.NET Interfaces

Over the past few years I've changed from having a long flowing page of controls that I hid/showed to using a lot of user controls. I've always had a bit of a discussion between co-workers on best practices. Should you have properties that you populate, or use paramterized sub's to load the information in your controls? Part of my fea...

Making one interface overwrite a method it inherits from another interface in PHP

The "Question": Is there a way in PHP to overwrite a method declared by one interface in an interface extending that interface? The "Example": I'm probably doing something wrong, but here is what I have: interface iVendor{ public function __construct($vendors_no = null); public function getName(); public function getVendors...

Non Public Members for C# Interfaces

In C#, when you implement an interface all members are public by default. Do you think it's better if we can specify the accessibility modifier (protected, internal, except private of course) or better use an abstract class instead? ...

Why can't I declare static methods in an interface?

The topic says the most of it - what is the reason for the fact that static methods can't be declared in an interface? public interface ITest { public static String test(); } The code above gives me the following error (in Eclipse, at least): "Illegal modifier for the interface method ITest.test(); only public & abstract are permi...

How can you require a constructor with no parameters for types implementing an interface?

Is there a way? I need all types that implement a specific interface to have a parameterless constructor, can it be done? I am developing the base code for other developers in my company to use in a specific project. There's a proccess which will create instances of types (in different threads) that perform certain tasks, and I need t...

Understanding Interfaces

I have class method that returns a list of employees that I can iterate through. What's the best way to return the list? Typically I just return an ArrayList. However, as I understand, interfaces are better suited for this type of action. Which would be the best interface to use? Also, why is it better to return an interface, rather th...

Interfaces and Versioning

I am designing a new System and I have a lot of Interfaces that will grow over time with the system. What is the best practice to name this interfaces ISomethingV01 ISomethingV02 etc and I do this public interface ISomething{ void method(); } then I have to add method 2 so now what I do? public interface ISomethingV2:ISometh...

Wacom tablet Python interface

Hello, If possible I want to catch pressure sensitive input from a Wacom tablet in Python. Are there any Python libraries available that can do this? Regards, Menno ...

Why do most system architects insist on first coding to an interface?

I'm not asking this question out of spite, but I really want to know, because I might be missing something. Almost every Java book I read talks about using the interface as a way to share state and behavior between objects that when first "constructed" did not seem to share a relationship. However, whenever I see architects design an app...

How to solve call ambiguity between Generic.IList<T>.this[] and IList.this[]?

I've got a collection that implements an interface that extends both IList<T> and List. public Interface IMySpecialCollection : IList<MyObject>, IList { ... } That means I have two versions of the indexer. I wish the generic implementation to be used, so I implement that one normally: public MyObject this[int index] { .... } I ...

XMLSerialization in C#

I have a simple type that explicitly implemets an Interface. public interface IMessageHeader { string FromAddress { get; set; } string ToAddress { get; set; } } [Serializable] public class MessageHeader:IMessageHeader { private string from; private string to; [XmlAttribute("From")] string IMessageHeade.FromAddress ...

What is the single best javascript lightbox script currently available?

What is the best javascript lightbox script currently available? I'm working on a project and am a bit baffled at the number of lightbox scripts out there. The one I need should: not allow flash movies to show through the grayed out background work in all browsers including IE6, Opera should allow html content, flash files easily ski...

Is it safe for structs to implement interfaces?

I seem to remember reading something about how it is bad for structs to implement interfaces in CLR via C#, but I can't seem to find anything about it. Is it bad? Are there unintended consequences of doing so? public interface Foo { Bar GetBar(); } public struct Fubar : Foo { public Bar GetBar() { return new Bar(); } } ...

Creating a Math library using Generics in C#

Is there any feasible way of using generics to create a Math library that does not depend on the base type chosen to store data? In other words, let's assume I want to write a Fraction class. The fraction can be represented by two ints or two doubles or whatnot. The important thing is that the basic four arithmetic operations are well d...

Define an interface in C++ that needs to be implemented in C# and C++

I have an interface that I have defined in C++ which now needs to be implemented in C#. What is the best way to go about this? I don't want to use COM at all in my interface definition. The way I have solved this right now is to to have two interface definitions, one in C++ and one in C#. I then expose the C# interfaces as a COM server. ...

Why would a static inner interface be used in Java?

I have just found a static inner interface in our code-base. class Foo { public static interface Bar { /* snip */ } /* snip */ } I have never seen this before. The original developer is out of reach. Therefore I have to ask SO: What are the semantics behind a static interface? What would change, if I remove the st...

Implementations of interface through Reflection

How to get all implementations of an interface through reflection in C# ...

Using the same test suite on various implementations of a repository interface.

I have been making a little toy web application in C# along the lines of Rob Connery's Asp.net MVC storefront. I find that I have a repository interface, call it IFooRepository, with methods, say IQueryable<Foo> GetFoo(); void PersistFoo(Foo foo); And I have three implementations of this: ISqlFooRepository, IFileFooRepostory, and IMo...

Designing a Yahoo Pipes inspired interface

I really like the interface for Yahoo Pipes (http://pipes.yahoo.com/pipes/) and would like to create a similar interface for a different problem. Are there any libraries that would allow me to create an interface with the same basic look and feel? I especially like how the pipes behave and how they are not just straight lines. Edit: T...

What are the benefits of the Iterator interface in Java?

I just learned about how the Java Collections Framework implements data structures in linked lists. From what I understand, Iterators are a way of traversing through the items in a data structure such as a list. Why is this interface used? Why are the methods hasNext(), next() and remove() not directly coded to the data structure impleme...