interface

Java - Why all fields in an interface are implicitly static and final?

I am just trying to understand why all fields defined in an Interface are implicitly static and final. The idea of keeping fields static makes sense to me as you can't have objects of an interface but why they are final (implicitly)? Any one knows why Java designers went with making the fields in an interface static and final? ...

Translating a MethodInfo object obtained from an interface type, to the corresponding MethodInfo object on an implementing type in C#?

The question I have is this: If I have the MethodInfo object, for a method, obtained from an interface type, and I also have the Type object for a class that implements this interface, but it implements the said method with an explicit implementation, how do I correctly obtain the corresponding MethodInfo object for the implementing meth...

Alternate name for BackingStoreException

I'm about to undertake the task of abstracting out all SQLExceptions from an ORM's public interfaces with something more generic - that is declaring a generic exception which would in most cases wrap say an SQLException), and I'm wondering about naming. I'm thinking of something along the lines of BackingStoreException or StorageMediumE...

Interfaces - Is This Overkill?

This is a pretty basic OO question but I'm curious if I've been going overboard. Let's assume the following hierarchy, which is an example along the lines of what I would typically create: IVehicle - IFlyable - IPlane - Plane - IHelicopter - Helicopter - IDrivable - ICar - Car -...

Override variable or force usage?

I want to force a class to define a certain variable from the class it implements. e.g. class Fruit{ String name; // Cause each fruit has a name } //Apple wants to get an error if it does not use the name variable class Apple implements Fruit { String name = "Apple"; } Is there a way to do that? Just like java.io.Serializab...

Software Applications Designs

Is strict OOD/Interface-based design/Aspect oriented design is desirable in case of a software application development? Or, is it desirable to mix all of them for the ease of coding? Are all successful and highly maintainable software applications strictly Object oriented, or, strictly Interface oriented, or, strictly Aspect Oriented, ...

Linq Expression in nHibernate...

I have an interface, called IRepository. One of the methods in this interface is: IEnumerable<T> FindByQuery(Expression<Func<T, bool>> predicate); I then have (for example) an IUserRepository, that implements IRepository. In my implementation of IUserRepository, currently called LinqToSqlUserRepository, i have implemented the FindByQ...

IUnknown interface -for COM \COM + objects ?

I am bit unclear in using IUnknown interface .Is IUnknown interface only meant to work with COM /COM + Objects and some unmanaged codes like Win APIs ? ...

Does typing to interface increase performance?

If I have an object with 50 getters/setters, where every 10 of them is defined under a new interface, and I type the object as one of those interfaces, will it increase performance? Not sure how method/variable lookups work, but it seems that if you type the object to something that has fewer methods, it would be faster to run those met...

Interfaced function returning type of implementing class

Hi all, I am looking to implement an interface which has a function which will return the type of the base class without using a generic interface. Is this possible? class MyClass : MyInterface<MyClass> // Would rather use one below class MyClass : MyInterface // Functions already know to use MyClass ...

How do I control what images Facebook attaches to the feed story when my website is shared?

When I add a Facebook link to my website, it picks up randomly large images from the site, and not quite attached to the story. How can I control what images are picked up by Facebook? ...

VB.Net IEquatable, Access Denied

I just have a simple Interface definition in my project, which I haven't even used yet. But when I try to build the project I get this error: Access is denied: 'System.IEquatable`1[Reactor.IOptions]'. Below is the interface: Interface IOptions Inherits Xml.Serialization.IXmlSerializable ' Optoins Should...

Retrieve a list of object implementing a given interface

Intro I am building a plugin architecture in my app. The plugins implement a given Interface IBasePlugin, or some other interface which inherited from the base interface: interface IBasePlugin interface IMainFormEvents : IBasePlugin The host is loading the plugin assemblies, and then creates the appropriate object of any class implem...

Do Events break Interfaces?

Note: in this question, I am talking about formal Interfaces (e.g. public interface IButton {...} ). I'm an Actionscript developer, but I suspect my question will resonate in many languages that allow both formal Interfaces and Events. I love Interfaces. I love the separation between interface and implementation. (I wish Actionscript...

How can I enforce a type constructor in a concrete class through the interface it implements?

Let me describe the situation, and I'm sure I'm just thinking about this problem incorrectly. I have a concrete class that will implement an interface. I want to enforce in the contract that the class must have a constructor with a specific type. So for instance: interface MyInterface {} public class MyClass implements MyInterface { ...

How to change EMS SQL Manager view from 'like Delphi' to 'like MS Office'?

The installer proposed me to choose more convinient view: like in Delphi or like in MS Office. I chose Delphi, but now I want to change it. And I cant find how to do it. Is is possible? ...

How do I MOQ the System.IO.FileInfo class... or any other class without an interface?

I am writing a number of unit tests for a logger class I created and I want to simulate the file class. I can't find the interface that I need to use to create the MOQ... so how do you successfully MOQ a class without an interface? It also isn't clear to me how I can use dependency injection without having an interface available: priv...

Why we are Implementing Interfaces ?

Why are we implementing, for example ICloneable,IDisposable. Actually I am not asking what ICloneable or IDisposable do, but I want to learn what's a good reason to implement these interfaces rather than just writing a method which dispose or clone our objects ? Thanks. ...

What is the easiest way to transfer a class with many dependecies in WCF (using shared DLLs)?

I've got a class which has properties referenced to couple of interfaces and classes. Now I'm trying to transfer this one class via WCF (named pipes), what's the best way to deal with it? Shall go into all referenced interfaces, class and mark stuff as <DataContract()>, <Serializable()> and <DataMember()>, which means at least 6-10 c...

How can I deserialize an interface type?

I serialize a class which includes a property called Model as IModel but when I try to Deserialize it I'm getting the following exception: System.Runtime.Serialization.SerializationException: Type 'MYN.IModel' in Assembly 'MYN.Defs, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' is not marked as serializable. It's binary seria...