File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes Interface implementation issues / question....  Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Interface implementation issues / question....  " Watch "Interface implementation issues / question....  " New topic

Interface implementation issues / question....

B West

Joined: Oct 10, 2008
Posts: 29
Hello, I will try to keep this as simple as possible and try to describe my problem accurately. I have to 4 classes :

Two of them are depts and the other two are Actions... The idea is that each dept will utilize a particular action. (Some FileDeletion functionality...)

I thought interfaces would do the trick...

The dept classes came together very quickly. However, I've run into problems with my action classes and the implementation of the Action interface...

The problem I'm running into is that my two action objects can't implement the method the same. Each action class needs to supply the method different arguments to achieve the desired actions.

for instance:

Obviously, this design is flawed, an Interface in this situation appears to just not make any sense. Is there maybe a different approach I can use? To achieve the desired affect? I could code the two object classes implementing all the needed methods, but that doesn't feel like a good OO design. I feel like I'm missing something.

Any help would be appreciated!

Sorry for the length and and for my ignorance.

Sebastian Janisch
Ranch Hand

Joined: Feb 23, 2009
Posts: 1183
You could use a var arg parameter ...

JDBCSupport - An easy to use, light-weight JDBC framework -
B West

Joined: Oct 10, 2008
Posts: 29
Thank you for your reply... For an issue like this, (I'm assuming it's a common issue...) Would this suggestion/method be a common practice... It sounds like a nice solution, but I'm trying to stay close to good design principles...
I agree. Here's the link:
subject: Interface implementation issues / question....
It's not a secret anymore!