interface

Should we use interface methods if we can?

Hi, The question is a bit hypothetical. Let's say I have an application that draws a tree. My structure controller implements the ITree interface that describes a normal tree with methods like: getChildren(), getParent() ... Some parts of the app only needs to know that the structure implements ITree, so it can look for it's children or ...

Interface Builder doesn't work

I have a trouble with Interface builder: I downloaded the iPhone SDK 4 but Interface Builder doesn't work: when I open it, it close immediately. What can I do??? ...

Delphi: trouble calling function returning interface

I'm trying to call a function returning an interface from another unit; for instance consider the following: program intf_sb1; {$APPTYPE CONSOLE} uses myunit in 'myunit.pas'; var MyBL: ISomeInterface; begin MyBL := GetInterface; end. where the content of myunit.pas is as follows: unit myunit; interface type ISomeInterface = i...

Are Interfaces just "Syntactic Sugar"?

I've been playing mostly with PHP and Python. I've been reading about Interfaces in OO programming and can't see an advantage in using it. Multiple objects can implement the same interface, but multiple inheritance doesn't provide this as well? Why do I need to create an Interface "with no implementation" - mainly a "contract" - if I ...

Unit testing interfaces and method calls

There are two testing scenarios I am unclear on. Both appear at first sight to create very brittle tests. First, when should one unit test the interface (i.e. verify that an interface has a set signature)? Second, when should one "test the sequence diagram" (a term I just made up) - meaning verifying calls are being made to the appropr...

How to find a dangling interface that causes an AV in Delphi

I've a complex application to which I've just introduced some changes, adding a couple of new classes with interfaces and deleting some others. Functionally it all works but I get an access violation just after the Destroy procedure of a class: "Access violation at address 0040B984 in module 'xxxx.exe'. Read of address 80808088". I kno...

Indexable interface

What C# interface should be used if I only want to be able to index into instances of a type? I don't need (or want) the ability to add/remove/edit elements. Enumeration is okay. Does this require a custom IIndexable type? In this case IList is overkill because it forces implementation of members I don't want to have. ...

Parameters implementing a certain interface and having a specific superclass: generics or instanceof?

I would love some help on a particular design. This is the code I wish worked: abstract class Square {...} abstract class Circle {...} interface JPGExportable {...} class SquareJPG extends Square implements JPGExportable {...} class CircleJPG extends Circle implements JPGExportable {...} interface Interface { draw(Square square);...

How should i refactor this?

so in my application I've got several different customers being "serviced". Each customer has their own implementations of various classes that are all based on interfaces. With the latest customer being added, I've noticed there will be a lot of duplication of code from another customer but the other customer is in no other way relate...

Interface declaration for base class method to support IoC

So here is the code: interface A<T> { T Save(); } interface B : A<B> { } class BusinessBase<T> { T Save(); } class D<T, U> : BusinessBase<T> where T : BusinessBase<T> where U : B<U> { new U Save() { base.Save(); // this is where the error is because T can't be converted to U } } class Concrete : D...

I am looking for C++ wrapper around built-in Perl functions

Hi, A while ago I found a library that allowed calling individual built-in Perl functions in C++, I cannot find it now. Can you tell me where I can find it on the net? Thanks. ...

C#: Enums in Interfaces

Hey all, I've seen a couple similar threads to this question, but none of them really answer the question I want to ask. For starters, unfortunately I'm working with existing API code so sadly, while there may be a better way to do what I'm asking about, I'm locked in to doing it similarly to the way it is because backwards compatibili...

How to implement define interfaces in class library and implement separate process

Hello, I have different interfaces defined in a seperate class library(assembly) and those needs to be implemented in a different process by classes defined in that process. Problem is interfaces defined in a seperate class library(assembly) and must be implemented in a different CLR process(assembly)? What I need to do ? just adding c...

C# - Is adding systematically an interface a good practice?

Hi, In the project I'm working on, I've noticed that for every entity class there is an interface. It seems that the original motivation was to only expose interfaces to other project/solutions. I find this completely useless, and I don't see the point in creating an interface for every class. By the way, those classes don't have any m...

Can you please tell me the reasoning behind this structure (Services + Interfaces in ASP.NET) ?

Hi All, I am new to Web/WCF/Services - so bear with me :) I am trying to analyse the code-flow in a .NET application but I have a hard time understanding the reasoning behind using the following approach when it comes to exposing services : Now, in the application, I have a C# Class Lib Proj which has a C# Class Library project call...

Interfaces as parameters

In what scenarios would somebody pass (or receive) an interface as a parameter? Is it really a useful thing or just a fancy way of doing something? ...

wireit: visualizing a directed graph with nodes that can contain nested graphs

Problem: There appear to be many tools for visualizing graph structures, but none of the ones I've seen so far seem to have the feature of "nesting". The WireIt library (apparently inspired by Yahoo Pipes) looks very promising, but it seems to lack this concept of nesting. To explain what I am thinking of, consider a Company Org Chart ...

Can we modify the font of a Label created by IB from source code ?

Friends, I am a beginner and trying to know iphone programming basics. If I create a Label from Interface Builder and Name it as "Sample", can I change the font of this Label name from source code. Is it possible. I have no clue how to do it. Can anyone help me in doing this. Thanks In Advance, Anil ...

Is it possible to create an object for an interface type

Connection con = DriverManager.getConnection("jdbc:odbc:MyDataSource1"); This is a JDBC programing line. In this line, we are creating an object for Connection interface. How it is possible? ...

Delphi with HTML/CSS interface

I want to develop a delphi application with an HTML/CSS graphical user interface, not necessarily running from within a web browser. I want to do this do create a richer graphical user interface with animations etc. and break away from normal VCL components / Windows look. Any suggestions? ...