interface

should interfaces (in java) be placed in a separate package?

i'm new to a team working on a rather large project, lots of components, dependencies. for every component, there's an 'interfaces' package where the 'exposed' interfaces for that component is placed. is this a good practise? my usual practise has always been interfaces and implementations in same package. was wondering what's the sta...

C#: Explicitly specifying the interface in an implementation's method

Why is it that when implementing an interface, if I make the method public I do not have to explicitly specify the interface, but if I make it private I have to...like such (GetQueryString is a method from IBar): public class Foo : IBar { //This doesn't compile string GetQueryString() { ///... } //But this ...

LINQ to SQL Table List to Interface List

I have the following code: public IQueryable<ITax> FindAllTaxes() { return db.Taxes; } I am getting the following error Cannot implicitly convert type 'System.Data.Linq.Table<Models.Tax>' to 'System.Linq.IQueryable<Interfaces.ITax>' I am trying to use Interface where ever I go, but not sure how to convert this, any help? ...

flex interface question

<?xml version="1.0" encoding="utf-8"?> <mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"> <mx:Label id="lb" text="check"/> <mx:Script> <![CDATA[ import mx.managers.BrowserManager; import mx.managers.IBrowserManager; public var brm:IBrowserManager = Brow...

Using delegates or interfaces to decouple the logging - Best practices - C#

My solutions has several projects which includes several libraries and one project for UI. Currently it is a windows forms application and I use log4net for logging. This UI project has only reference to log4net and this project maintains the configuration files. But I would like to log from my libraries as well. Usual method for doing...

Control Philips Living Colors using PC

Hi guys, is there a way (hardware/software-combination) that I can use to control one or more "Philips Living Colors" lamps using a PC - e.g. a USB-stick that acts as the "remote". This way i could control the lamp through software (e.g. a web-app - over iPhone / remotely) or even create what Philips builds into some of their TVs and ca...

What is a class interface?

I'm currently working my way through Code Complete and the word "interface" keeps popping up! I'm trying to get my head round what an interface is. Can you define the term? Also what actually makes up a "class interface"? ...

What is the purpose of a marker interface?

What is the purpose of a marker interface? ...

Why collections classes in C# (like ArrayList) inherit from multiple interfaces if one of these interfaces inherits from the remaining?

When I press f12 on the ArrayList keyword to go to metadata generated from vs2008, I found that the generated class declaration as follows public class ArrayList : IList, ICollection, IEnumerable, ICloneable I know that the IList already inherits from ICollection and IEnumerable, so why does ArrayList redundantly inherit from these in...

Implementing Interface in code

I have been scratching my head over this for days and I still cannot understand how to implement this interface. Here is my code: namespace ConsoleApplication32 { public static class ScanAndSerialize { public static void Serialize() { List<string> dirs = FileHelper.GetFilesRecursive("s:\\"); List<string> dirFi...

C# inheritance

Let's say I have the following code: interface ISomeInterface { void DoSomething(); void A(); void B(); } public abstract class ASomeAbstractImpl : ISomeInterface { public abstract void A(); public abstract void B(); public void DoSomething() { // code here } } public class SomeImpl : ASomeA...

ASP.NET MVC - Model Interfaces

Seeing as though I've now solved all of my LINQ problems I'm not working on developing an actual model. The thing is with this is that I do not want to be tied in to a single technology, I want to have freedom to implement different data access technologies and work to a single interface. Now, I've never done this before, but based on ...

What are some advantages to using an interface in C#?

I was forced into a software project at work a few years ago, and was forced to learn C# quickly. My programming background is weak (Classic ASP). I've learned quite a bit over the years, but due to the forced nature of how I learned C#, there are a lot of basic concepts I am unclear on. Specifically, an interface. I understand the b...

How to design an application such that it's easily testable using unit testing?

Possible Duplicate: Writing unit testable code? I am new to unit testing. Today on SO I found an answer to a question about interfaces in c#. That got me thinking about best practices for building an applications that's testable by design. I use interfaces very lightly in the main application that I work on. That's made it v...

Delphi 2009 - Can an Interface Property Cause a Memory Leak?

I inherited an Intraweb app that had a 2MB text file of memory leaks as reported by FastMM4. I've got it down to 115 instances of one class leaking 52 bytes. A brief description of the bad actor is: TCwcBasicAdapter = class(TCwcCustomAdapter) protected FNavTitleField: TField; function GetAdapterNav(aDataSet: TDataSet...

Hardware to do i/o to and from external devices

I've got a potential client who wants a database driven app, either in Java or Python driving MySQL or PostgreSQL, but we need to get input from an external machine, such that every time this external machine closes a microswitch, a value in the database gets decremented and it shows up on the app. Also, when that value in the databas...

Can I create a class that is inherited from a class and from interfaces in Delphi?

I have a class TDevice. Some devices will have a cellular module. So I create an Interface IIMEI. Others devices will have an Ethernet Module. So I create an Interface IMacAddress. So, I'd like to create another class that is a child of TDevice and implements IIMEI or IMacAddress or both. Is it possible in Delphi? ...

Need Help understanding Interfaces

Hi I am still having trouble understanding what interfaces are good for. I read a few tutorials and I still don't know what they really are for other then "they make your classes keep promises" and "they help with multiple inheritance". Thats about it. I still don't know when I would even use an interface in a real work example or even...

C#: Should an ILog interface be or have an IEnumerable<Message>?

Lets say we have this interface: public interface ILog { void Add(Message message); } It should of course also have some way of accessing those added messages. But what do you think is more natural and correct? That ILog implements IEnumerable property? Or maybe both? Or will having both be a bit weird and unecessary? Or should it...

Which design option is better to use in coding a framework?

I'm coding up a framework (in Java, but question is generic) in which I will provide a set of interfaces for clients to implement. The functions in the framework are going to rely on how the implementation classes will be constructued, that is, thay depend on those implementations to provide other instances of interfaces. For example I ...