Introduce interfaces for Phidget classes in Java/C# libs

What do you need Phidgets to do for you?
Post Reply

Would you like interfaces in Java/C# libraries?

Yes
5
83%
No
0
No votes
I'm using another programming language.
1
17%
 
Total votes: 6

guylabs
Fresh meat
Posts: 1
Joined: Thu Jun 07, 2012 11:55 pm
Contact:

Introduce interfaces for Phidget classes in Java/C# libs

Post 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
Attachments
phidget-interaces.tar.gz
Sample interfaces.
(958 Bytes) Downloaded 1011 times
jamie.dixon
Fresh meat
Posts: 1
Joined: Wed Aug 17, 2011 6:35 am
Contact:

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

Post 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...
deboraha
Fresh meat
Posts: 1
Joined: Thu Jan 24, 2013 4:17 am
Contact:

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

Post by deboraha »

So I really have to do set the template from the ...compiler list and selecting Microsoft .Net...then select c#
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest