interface

Can one implement an interface property on an Entity Object interface?

I'm using Entity Framework and I have created an interface for lease transactions: public interface ILeaseTransaction { int ID { get; } DateTime Date { get; } decimal Amount { get; } } Then to implement the interface on the Entity Object I created an empty partial class: public partial class Type1LeaseTransaction : ILease...

Modularity: Using Interfaces or not?

Since a few years, common sense seems to dictate that it's better to program against interfaces rather than against implementations. For high-level code this indeed seems logical, e.g. if I have a complex solver in my application, it seems better to have something like this: ISolver *solver = solverFactory.getSolver(); solver->solve(in...

Java: using polymorphism to avoid if-statements?

I'm attempting to write a java program that initializes certain layouts based on what the user selects. What I want to do is try to avoid writing a bunch of if-statements so the code can be scalable for future use if more layouts need to be added. I heard the best way to implement this is using polymorphism but my understanding of polymo...

when we need to implement abastract class and when Interface

Possible Duplicates: Abstract classes vs Interfaces Abstract class and Interface class? Hi All, I have little bit confusion about the use of the abstract class and Interface, when we need to Implement abstract class and when Interface. Thanks Vijendra Singh ...

Is there any way in C# to enforce operator overloading in derived classes?

I need to define an Interface which has to enforce certain operator overloading to the types which implements it. There doesn't seem an obvious way to do it since operator overloading has to be done using static methods in class. Is there any way to achieve the same effect (using abstract classes or anything else)? ...

Why setters are bad in interfaces?

Why setters are bad in interfaces if we are speaking about domain objects? Clarification: I have a domain object which stores in db. It has several fields which is very costly to set. I.e. class JurasicPark { private long area; ...other fields ... getters and setters .... private Collection<Dinosaur> dinosaurs; privat...

Web Service proxy class to implement interface

I am looking for a way to have the generated proxy class for a Web Reference (not WCF) implement a common interface in order to easily switch between web service access and "direct" access to our business layer in the client application, something like: public IBusiness GetBusinessObject() { if (_mode = "remote") return new Busine...

Application interface translations

Where can I translate my web application terminology like: "copy and paste", "drag and drop", "click link",.. I am looking for a free on-line resource. ...

How to ensure that an event from an interface is actually raised?

There are many questions about events in interfaces. Here are a couple: http://stackoverflow.com/questions/471352/raising-events-in-interfaces http://stackoverflow.com/questions/1093139/c-events-and-interfaces As interfaces are used to enforce a contract for implementation, this makes no sense to me, because it doesn't enforce the ac...

Connect a UILabel in Interface Builder and XCode?

I am trying to do something as simple as add a Label to a View in XCode and IB and I can't figure out how to do it. All the samples I find online are for older versions of IB so the directions aren't correct. I have a label on my .xib file, in my Controller.h file I have an IBOutlet UILabel declared with a Property set up. In my Contr...

MS SQL database Admin/IDE

I'm using MS SQL for a project, but have always used MySql in the past. MySql has a really nice interface which lets you build queries, offers help, backup etc. What free programs are there for MS Sql that can do this. I'm currently a student so I have free access to MS Sql but the only interface I have for it right now is Visual St...

Interface in plain english

Please explain using plain english why we need and why we use Interface in Object Oriented development. I am in serious confusion. [+] I'm working on Java. Please provide sample code in Java if any. Thanks all. ...

Instantiate interface in JAVA?

I'm reading the docs on the UIBinder of GWT and the first code snippet made me confused: public class HelloWorld extends UIObject { // Could extend Widget instead interface MyUiBinder extends UiBinder<DivElement, HelloWorld> {} private static MyUiBinder uiBinder = GWT.create(MyUiBinder.class); @UiField SpanElement nameSpan; pu...

Code to interfaces instead of implementations?

I believe that it's better to code to interfaces instead of implementations. In Java: List<User> users = new ArrayList<User>(); There's no need to specify the runtime type of users all over the program if the code only cares that it implements List. However, I encounter many people who believe that it's totally fine, even when they'r...

Conversion of Inteface from vb.net to c#

I have a control that overrides the protected GetService method and assigns it to the IServiceProvider interface: Class MyControl Inherits Control Implements IServiceProvider Protected Overrides Sub GetService(t as Type) as Object Implements IServiceProvider.GetService End Sub End Class I'm struggling to convert this...

How to reflect on C# explicit interface implementation from the call stack?

Is it possible to reflect on an explicit interface implementation from the call stack? I want to use this info to look up an attribute on the interface itself. Given this code: interface IFoo { void Test(); } class Foo : IFoo { void IFoo.Test() { Program.Trace(); } } class Program { static void Main(string[] args) ...

Interface Bulder and XCode: change color of a view "top bar"

Hi, I have a couple of views in my iPhone app. each view shows a "top bar" in blue, I haven't added a "Navigation Bar", simply edited what's on the inspector "View Controller" section and gave it a title. (this section: http://img69.imageshack.us/i/schermata20101001a22014.png/) Is it possible to change the color of this bar that'a autom...

How to populate 3 text fields with 3 different ViewController?

Hi I have the following situation: 1) On the main ViewController, I have 3 UITextFields. The user can fill them with keyboard or choose values from 3 ViewsController, which have a Picker to choose from values; 2) Now, I can declare 3 NSString in the main View Controller (obviously with @property(retain, nonatomic) so that they are to ...

What does the source code for IEnumerable look like?

Hi everyone, I'm in the process of learning Interfaces. I've been reading through some books/articles and so far so good - I've written a few sample Interfaces of my own. Yay :) Now, I've noticed that one of the most popular C# Interfaces around is the IEnumerable Interface. It's used quite a lot for all sorts of collections etc.. Any...

Where did java get the idea for Interfaces from?

I'm aware that most things in modern programming languages are at least partially based on features in earlier languages. This leads me to wonder where java got the inspiration for interfaces from. Was it mostly their own creation? Was it based on fully Abstract Base classes(with multiple inheritance) ? ...