interface

What does "program to interfaces, not implementations" mean?

One stumbles upon this phrase when reading about design patterns. But I don't understand it, could someone explain this for me? ...

How can I access a postgresql database from matlab with without matlabs database toolbox?

I tried already to use pgmex. Unfortunately it doesn't work with libpq5 (matlab immediately crashes). ...

C# naming convention for extension methods for interface

I typically name my C# interfaces as IThing. I'm creating an extension method class for IThing, but I don't know what to name it. On one hand, calling it ThingExtensions seems to imply it is an extension class to some Thing class instead of to the IThing interface. It also makes the extension class be sorted away from the interface it...

C#: Abstract classes need to implement interfaces?

My test code in C#: namespace DSnA { public abstract class Test : IComparable { } } Results in the following compiler error: error CS0535: 'DSnA.Test' does not implement interface member 'System.IComparable.CompareTo(object)' Since the class Test is an abstract class, why does the compiler require it to implement the i...

Understanding reflection

I recently started work at a new company and a .net web application we have is built using reflection. I have only been out of school for a year and haven't worked with this concept. After studying the code... it looks like there is a single backend interface of type object that has about 20 classes that inherit from it. lots of generi...

C/C++ opaque pointer library

hello Is there library/header already written to manage C++ objects from C using opaque pointers/handles? I can write one myself, but I would rather use already made solution, especially if it has fortran bindings. my specific requirements are: wrapper generation facility (my thought is to use boost preprocessor) handling objects th...

C# Invoke method Class/Interface (native code, cost)

Hello, Suppose we have some class A that implements some interface I I i = new A(); i.method(); // example 1 A a = (A)i; a.method() // example 2 The IL code generated for each call to "method()" is same, but which one of invocations to method "method()" have more cost in native code and why? Any help will be appreciated. ...

Does the usage of interfaces slow down programs?

Possible Duplicate: What is the performance cost of having a virtual method in a C++ class? Is it true that interfaces slow down programs? I have heard that this is the case because during running time each during each usage of an object implementing this interface the decision has to be made which class implementing the inter...

Multiple WCF Services implementing same Service Contract interface

Is it possible for multiple wcf services to implement the same service contract interface? What I want to do is allow for a test service to be interchangeable for the real service, and to specify which service to be used in the configuration file. For example: [ServiceContract] public interface IUselessService { [OperationContra...

Are there any open source SimpleTest Test Cases that test PHP SPL interfaces

I have quite a few objects in my system that implement the PHP SPL Iterator interface. As I write them I also write tests. I know that writing tests is generally NOT a cut 'n paste job. But, when it comes to testing classes that implement Standard PHP Library interfaces, surely it makes sense to have a few script snippets that can b...

Understanding Covariant and Contravariant interfaces in C#

I've come across these in a textbook I am reading on C#, but I am having difficulty understanding them, probably due to lack of context. Is there a good concise explanation of what they are and what they are useful for out there? Edit for clarification: Covariant interface: interface IBibble<out T> . . Contravariant interface: int...

Java Memory Overhead

Hello, I would like to ask about Memory Overhead in java, I have a large ArrayList (61,770 items), and trying to calculate the amount of memory taken by each item (counting the object and its ArrayList entry), by profiling the app i get that after all the data is loaded, the heap takes ~ 25Mb. when the ArrayList has only 2 items the heap...

Implementing few methods of a interface class-C#

Is it possible in C# to have a class that implement an interface that has 10 methods declared but implementing only 5 methods i.e defining only 5 methods of that interface??? Actually I have an interface that is implemented by 3 class and not all the methods are used by all the class so if I could exclude any method??? I have a need f...

why create CLSID_CaptureGraphBuilder2 instance always failed in a machine

It's a real strange issue, the machine information below is from DXDiag. There is no error reported, but create CLSID_CaptureGraphBuilder2 instance always failed in the machine. It's okay to create CLSID_FilterGraph. Before create CLSID_CaptureGraphBuilder2, I have called CoInitialize and created CLSID_FilterGraph. Only this machine has ...

Using Covariance with an Interface Base Type in .NET 4?

I have some entities created with LINQ-to-SQL. Six of these entities (representing values primarily in drop-down lists) implement an interface I've called IValue. I did this because the UI layer is going to have to account for a couple special cases -- notably, what to display if the original value on a record has been flagged as deleted...

WCF Service and Properties

Hi all, Here is my question, I have a solution with 4 projects in it for a WCF Service : DLL Library : Service Interface. DLL Library : Service Code. Form Application : Service hosting application. Form Application : Service client application. I'd like to have certain properties of the service accessible for the hosting application...

Serialize Objects using xmlSerializer.Serialize and IEnumerable objects

I have an object that holds an object that is definded as IEnumerable, i.e. [Serializable] [XmlRoot("MyObject")] public class MyObject { [XmlAttribute] public string Name { get; set; } [XmlArrayAttribute("Numbers")] public IEnumerable<string> Numbers { get; set; } } When I run the XmlSerializer.Serialize against the o...

Use method not defined in Interface [Java]

Hello World, I have an assignment and i got a library including an interface class. [InfoItem] I implement this class [Item]. Now i am required to write a method watchProgram(InfoItem item) [other class, importing InfoItem], which (as shown) requires an InfoItem. The passed parameter item has a variable 'Recorded' [boolean] which i w...

Scrollbars for Infinite Document?

Is there a standard Aqua way to handle a practically infinite document? For example, imagine a level editor for a tile-based game. The level has no preset size (though it's technically limited by NSInteger's size); tiles can be placed anywhere on the grid. Is there a standard interface for scrolling through such a document? I can't sim...

Java: reusable encapsulation with interface, abstract class or inner classes?

I try to encapsulate. Exeption from interface, static inner class working, non-static inner class not working, cannot understand terminology: nested classes, inner classes, nested interfaces, interface-abstract-class -- sounds too Repetitive! BAD! --- Exception 'illegal type' from interface apparently because values being constants(?!) ...