• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Tim Cooke
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Frank Carver
  • Henry Wong
  • Ron McLeod
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Himai Minh

Interface implementation issues / question....

 
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.


cheers,
 
Ranch Hand
Posts: 1183
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You could use a var arg parameter ...


 
B West
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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...
 
He loves you so much! And I'm baking the cake! I'm going to put this tiny ad in the cake:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic