This discussion is archived
1 Reply Latest reply: Dec 10, 2012 12:01 AM by Kayaman RSS

How to implement acommon interface

meandmycode Newbie
Currently Being Moderated
Hi,

We design a lot of testcases ( testng) that we use to test out our 'system' with. We use a lot of 3rd party tools ( libraries). Since everyone use/implement these tools differently ( depending on java knowledge) I would like to create a common interface towards these tools. Let me take an example:

As a tester I would like to have a a method accessible like this that I can access from my test case:

- getVideoCard()

Behind the scenes there could be different tools that do the actual operation on our system. I would like to hide that complexity and provide users with the method call and then the rest is handled by the implementation of the framework.

In code I will implement an interface called systemoperations and a class called systemimplemetation that implements this interface. I wonder if this interface will grow too big with operations. Or is it better to have more that one interface?
For example a grahicoperations() and audioperations(). The drawback with this is that I could have redundant methods.

I don't have much experience of providing a public api so any pointers hints or personal experience is appreciated.

//mike
  • 1. Re: How to implement acommon interface
    Kayaman Guru
    Currently Being Moderated
    meandmycode wrote:
    I wonder if this interface will grow too big with operations.
    Depends on how complicated were you planning to make it.
    Or is it better to have more that one interface?
    Well it certainly is easier to have 5 interfaces with 20 methods instead of 1 interface with 100 methods.
    For example a grahicoperations() and audioperations(). The drawback with this is that I could have redundant methods.
    Redundant methods aren't a drawback, and if they are it means your design is poor. I don't see how GraphicsOperations and AudioOperations would have methods in common.
    I don't have much experience of providing a public api so any pointers hints or personal experience is appreciated.
    If you don't have experience doing it, maybe you shouldn't be the one doing it?

    You seem to be confusing even the nomenclature, proposing "graphicoperations()" as a name for an interface, when it's clearly a method's name. That would mean that you don't have the experience required to create something that would be of great use. Nothing personal here.

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points