Page 1 of 1

Introduce interfaces for Phidget classes in Java/C# libs

Posted: Fri Jun 08, 2012 12:08 am
by guylabs
Hello Phidget-Community,

one month ago I started writing an application in Java which uses Phidgets to control the lights and speakers in each room of my house. I'm working with spring and I'm used to test everything quite well. And my main problem is that I can't mock a Phidget without heavy usage of a mock framework.

My idea is that the Phidget Team could introduce interfaces for the main Phidget classes and the Manager, such that each developer has the possibility to mock against the interface and implement his own Phidget mock. This would be a non invasive refactoring and the developers could easily dependency inject the Phidget classes.

The classes in the event package doesn't need to be refactored.

What do you think about this?

I attached two sample interfaces which should point out the idea. I'm willing to help the Team implementing the interfaces if they would consider to introduce the interfaces.

I also found some posts about this feature request:

http://www.phidgets.com/phorum/viewtopi ... =22&t=4057
http://jamessdixon.wordpress.com/2010/0 ... last-week/
http://robseder.wordpress.com/2010/11/1 ... t-started/

Please vote for this feature request such that we can test the Phidgets framework easily.

Thanks and regards,

Guy

Re: Introduce interfaces for Phidget classes in Java/C# libs

Posted: Mon Jun 11, 2012 4:17 am
by jamie.dixon
Agreed - but with the new Mocking Framework in VS2012, I beleive you can mock against concrete, sealed, and other types of classes that were heretofore unmockable via MOQ or Rhino Mocks.

In any event, using Interfaces is always a great idea. At a minimum you can make the concrete classes partial classes, so devs can add in additional features and interfaces that they can use...

Re: Introduce interfaces for Phidget classes in Java/C# libs

Posted: Thu Jan 24, 2013 4:19 am
by deboraha
So I really have to do set the template from the ...compiler list and selecting Microsoft .Net...then select c#