Interesting Applications of Interfaces
Why are interfaces useful? Actually, I have a [small] idea of why interfaces are useful/necessary but... What are [interesting or realistic] applications of interfaces? ...
Why are interfaces useful? Actually, I have a [small] idea of why interfaces are useful/necessary but... What are [interesting or realistic] applications of interfaces? ...
My class has the following core: class SmartDbConnection { private readonly IDbConnection Connection; public SmartDbConnection(string ConnectionString) { if(ConnectionString.Contains("MultipleActiveResultSets=true")) { Connection = new SqlConnection(ConnectionString); } } } I don't want it to have "SqlConnection" hardcod...
If i have an interface: interface IFoo { int Offset {get;} } can i have this: interface IBar: IFoo { int Offset {set;} } so consumers of IBar will be able to set or get? ...
I am planning to start an application which converts the speech to text in Linux. Are there any existing interfaces so that I can extend them? or Is there any such existing application in Linux? Any inputs on this? EDIT: The application that I am planning to write should be able convert every word that we speak to text, not just the Yes...
I am not sure where the best place to put validation (using the Enterprise Library Validation Block) is? Should it be on the class or on the interface? Things that may effect it Validation rules would not be changed in classes which inherit from the interface. Validation rules would not be changed in classes which inherit from the cl...
My project build is forked. Now that main and forked build will probably have some interface changes. I have client that tests interfaces in main build and I need to use the same client to test these changes in fork build. what is the best way to test interface changes in both with single client. One thought I'm heading is to get the...
From what I have gathered, I want to force a class to use particular private fields (and methods) I need an abstract class because an interface only declares public/static/final fields and methods. Correct?? I just started my first big java project and want to make sure I'm not going to hurt myself later :) ...
I'm not quite sure how to explain this (that's why the title is kinda weird) but I'll have a go. Basically I'm doing some Oject-Oriented Design and I want to represent various different types of object, each of which can have various actions which it can perform. An example might help: things such as a File which can have delete, rename ...
I have a problem: imagine I have a plugin-based system. I need some kind of interface with which I could catch events from every plugin, which implements for example IReporting interface. (IReporting) object.OnSomeEvent += <.....> But I can't find a way to do that. ...
I have a 100 classes that have some similar elements and some unique. I've created an interface that names those similar items eg: interface IAnimal. What i would normally do is: class dog : IAnimal But there are 100 classes and i don't feel like going though them all and looking for the ones that i can apply IAnimal to. What i want ...
I have ControlA which accepts an IInterfaceB which has a property of type List<unknownType> In an event of ControlA i need to add a new instance of unknownType to the List in IInterfaceB... unknownType needs specific properties so i immediately thought it could be an interface, but quickly realised interfaces cannot be instantiated......
My application has 2 "services", let's say one is a basic (integer) calculator, and one is a floating point calculator. I express these as interfaces like so: public interface IBasicCalculator { int Add( int a, int b ); } public interface IFloatingPointCalculator { double Add( double a, double b ); } I want to expose these via WCF....
I'm implementing a project in MVP pattern and I've got some interfaces like this: public interface IWizardStep { event EventHandler NextStep; } public interface ISubmitable { event EventHandler Submit; } public interface IStep : ISubmitable, IWizardStep { string SomeProperty { get; set; } } My presenter class then has this: ...
EIMI being an explicit interface member implementation. So instead of: public int SomeValue{get;} you have int SomeInterface.SomeValue {get;} I'm currently considering using one as i'm using an internal interface (to decouple, yet restrict) and I don't want to make the methods on the implementing object to appear in its public API....
Okay, I have ran in to a problem with VB.NET. So all those defenders of VB.NET please can you help me out? Here is my issue: I am using LINQ to Entities, it also works with LINQ to SQL, I build my edmx file I then create a Partial Publc Class of the same name as one of the entities All fine up to now, so here comes the problem. I need ...
Ok, I've read the Stack Overflow question 'What does it mean to "program to an interface"' and understand it. I understand the benefit of using interfaces (at least I think I do). However, I'm having a little bit of a problem applying it to what I'm currently working on which would be my first interface implementation. I'm creating an c...
Should I make my own framework by wrapping up the STL classes and/or Boost libraries so that if I need to change the implementation of the string, vectors, lists, etc. or I need to write functions that MFC, other other libraries or even other platforms would need to use their format, I can easily mutate them to meet the criteria. this i...
Is there a common way to express the usage of arguments in C++? I want to implicitly tell the consumers of my class how the arguments they pass will be used by the class. Examples: I own your argument (will clean it up) I will hold a reference to your argument during my lifetime (so you should NOT delete it while I'm stile alive) I w...
Given the following interfaces: interface IFoo { void Foo(); } interface IBar : IFoo { void Bar(); } what is the best way to indicate that a given class implements IBar? Approach A: class Implementation : IBar { ... } This seems simpler and cleaner but it does not indicate that Implementation implements IFoo. Approach B:...
This may be a generic OOP question. I wanted to do generic comparison between an interface and an abstract class on the basis of their usage. When would one want to use and interface and when would on want to use an abstract class? ...