Well, smack me and call me silly.

I did not know you could extend interfaces multiple times, kind of like multiple
inheritance in C++. Solve a problem for me. But it makes a design question for
me.

For those who don't know, I am almost done with a 100% Java based CyberCash API,
which I'll be releasing to the community in a couple of weeks.

So, you have the scope of what I am trying to do here. And here is my design
problem.

I have 2 interfaces (comments stipped for brevity):

public interface CyberCashResponseIF {
  public Properties getResponse();
  public void setResponse(Properties response);
}

public interface CreditPaymentInformationIF {
  public String getOrderNumber();
  public String getCardType();
  public String getCardZip();
  public String getCardState();
  public String getCardCountry();
  public String getCardCity();
  public String getCardNumber();
  public String getCardName();
  public String getCardExp();
  public String getCardAddress();  
  public String getCardAmount();  
}

These of course represent a response and request to a CyberCash Merchant server.
I used the names Cybercash does in their MCK documentation,
CreditPaymentInfomation = request in Cybercash lingo.

The Cybercash "engine" looks likes like this:

public class CyberCash extends Thread {
  public CyberCash([MY DESIGN QUESION HERE] transaction) { }
  public void run() {}
}

Because I extended Thread, I more or less have to pass everything in via the
constructor, so every cybercash transactions has a request and a response so
what I did what was this:

public interface CyberCashTransActionIF 
  extends CreditPaymentInformationIF, CyberCashResponseIF {
}

Changed Cybercash constructor to this:

  public CyberCash(CyberCashTransActionIF transaction) { }

My question is: Is this a hack?

An interface that just extends 2 other interfaces just to combine them into a
nice "package" seem wrong to me OO desing side, but my old C-hack side says it
works, so do it.

Futher design details show that there are some object that just do
CreditPaymentInformation and other classes that just do CyberCashResponse, but a
majorit of them do both.




-- 
Bob Tanner <tanner at real-time.com>       | Phone : (952)943-8700
http://www.mn-linux.org                 | Fax   : (952)943-8500
Key fingerprint =  6C E9 51 4F D5 3E 4C 66 62 A9 10 E5 35 85 39 D9