interface

Should naming of methods within interfaces be concrete or abstract?

Often when I create new classes, I first create a new interface. I name the methods of my interface exactly as I would like them to behave. A colleague of mine prefers to have these method names being more abstract, ie: areConditionsMet(). The reason, he wants to hide the 'implementation details'. IMO implementation details are differen...

Good examples of dynamic error messaging ?

Yesterday I came accross an interesting blog post describing the need for stronger user interface design for software error popups, they use apple as an example - thought i'd share: http://bit.ly/9qBZLM This got me thinking - could you build something like this dynamically to handle a variety of exceptions / errors? Any examples of ot...

Whats the difference in terms of memory usage (clean up, etc) of Delphi Interface and C# interfaces

I am a Delphi programmer and trying to get some stuff done with C# here. Does interfaces in C# works in the same way as in Delphi - you don't need to worry in freeing it as it is freed when its out of scope. ...

using CLR interfaces with F# types

im having a bit of problems using any decent C# interface with my F# types so given i have the following C# interface in one project... //C# namespace FunctionalInterfacing { public interface IFoo { string Bar(string a, string b); } } and now i want to write a type in F# that implemented that.. #lig...

How to understand NSObject, it is both protocol and interface.

You can see following in NSObject.h file // 1. here is a protocol @protocol NSObject // 2. here is an interface, conforming to the above protocol @interface NSObject <NSObject> { ... // 3. what is the meaning of "( )" below? NSCoderMethods is a protocol @interface NSObject (NSCoderMethods) NSObject is so important that...

Override explicitly implemented interface method in derived class

I want to explicitly implement an interface method on a base class. Beyond this, I wanted to make this method virtual so I could override it on a derived class, but explicitly implemented methods do not allow this. I have tried making a protected virtual method in the base, calling this from the interface method, and then overriding th...

Porting code from Reflection to using an Interface, some API's not implemented.

I have some old C# plugin code that was implemented strictly with Reflection. In fixing some C# 2.0 -> 4.0 compatibility issues ("Load from Remote Source") I've decided to get rid of the old reflection code and replace it with an interface. The interface is needed because the Plugins now need to be loaded into their own AppDomain and t...

Getting the string name of an interface using Delphi RTTI

I have proved that I can get the name of an interface from its GUID using Delphi 2010 (eg IMyInterface converted to the string 'IMyInterface'. I'd like to achieve this in Delphi 7 (for compatibility). Is this possible? Or are there fundamental compiler limitations. ...

Inherit the UITypeEditor from Interface in PropertyGrid

As Attributes inherited from interfaces are not returned by the GetAttributes method, the PropertyGrid doesn't show the UITypeEditor associated with a property which is inherited from the Interface. To get it working I need to add the attribute to every time that implements the Interface. Is there any method in PropertyGrid that I can ...

How to Refactor a fat interface?

Lets say i have the following set of interfaces.... public interface IStart { void M1(); bool IsWorking { get; } } public interface IStartStop : IStart { void M2(); event EventHandler DoM1; event EventHandler DoM2; } public inter...

Could not load type '<typename>' from assembly '<assemblyname>'.

I decided to modify some code today, and encountered an error that doesn't make any sense to me. I have an interface called IDatabase and a class that inherits from it, called Database. I originally just put IDatabase in the same assembly as Database, but I didn't like this because it would prevent another person from creating a new ty...

How to dynamically layout UIViews for a UIViewController

Hello, (For example) I would like to have my background image – a UIImageView – always the same size as the UIViewControllers view. I am unable to figure this out, but sure it is possible. I'm making some UI Elements which I would like to reuse, and which can layout dynamically depending on how big my view controller's view is. How ca...

How to write Internal mockable method

We are using Moq as our mocking framework, the problem is that type that needs to be mock-able is done using an interface, the problem with that is anything in that interface will be public and therefore considered part our public API. is there a way to have to have a member that is mockable and not public? ...

How does this class implement IDisposable if it doesn't have a Dispose method?

FtpWebResponse implements IDisposable, but it doesn't have a Dispose method. How is that possible? ...

How do you unit test an interface?

For example, there is a interface IMyInterface, and three classes support this interface: class A : IMyInterface { } class B : IMyInterface { } class C : IMyInterface { } In the simplest way, I could write three test class : ATest, BTest, CTest and test them separately. However, since they support the same interface, most test code ...

ASP.Net MVC 2 - Model Coupling with Repository

Referring to this question, let's say we have the following scenario - A model class User that implements IUser [MetadataType(typeof(IUser))] public class User : IUser And a repository that handles saving, retrieving etc. of this from whichever datastore we want to use public class UserRepository : IRepository<User> IQueryable<User...

How to GET (not set) the focus in a J2ME Form?

This helps you to bring focus to a specific textfield: yourMidlet.getDisplay().setCurrentItem(tField); But what method can be used to findout if the focus is on a specific textfield? I excpect something like if(yourMidlet.getDisplay().getCurrentItem().equals(tField)) { ... ...

iPhone UI design...!!

Hi All, I have seen apps in App Store that have really attractive UI.When i make an app i use only the default set of control provided by Interface Builder and my app(even though good in functionality)does not have a UI that can attract people.Is there any ref or sample code that teaches us how to design good UIs for iPhone apps. Also...

Update applications for iPhone 4 Retina Display

Hello, I was just wondering how you would go about giving a application the new sharper images for the iPhone 4? i know the SDK already cleans up text and UI elements but how should I go about updating my image UI. Is there a different way (like a folder or file extension) to add the new images for the iPhone 4 or should I just go and ad...

TDD, creating layer of abstraction

Hi guys, Basically, there is a system at my work place that provides OCR capabilities. The process is that, a third party application is configured to display a captured screen (during the OCR process) and a user sits at the pc making sure the captured data is correct. This capture stage has validation on each of the fields. for exampl...