Skip to main content

All Questions

0 votes
3 answers
3k views

How to handle a new method in the interface that is not applicable for all classes?

I am faced with an interesting OOD problem: I have an interface with 3 methods: interface TestInterface { String action1(); String action2(); String action3(); } and 3 classes that ...
Zed's user avatar
  • 117
1 vote
1 answer
76 views

Modeling objects that behave in different ways so that they can be stored in a collection?

Suppose I have a Player class with an Inventory: public abstract class Player { private final List<GameObject> gameObjects; public Player(){ this.gameObjects = new ArrayList&...
EmilyScott's user avatar
3 votes
1 answer
4k views

Should an abstract class implement an interface, as opposed to defining its own abstract methods?

I'm defining a class structure for persisting to our cassandra database, and I'm unsure about using a combination of an abstract class and an interface. I have two concrete classes, one for persisting ...
Eoin's user avatar
  • 141
6 votes
4 answers
11k views

Are empty interfaces (but not marker interfaces) a bad programming practice?

I'm designing an architecture in which I have: public interface IObjectReader{ public Object read(); } public class ConcreteObjectReader implements IObjectReader{ @Override public ...
sibly22's user avatar
  • 63
-1 votes
3 answers
2k views

Can I say Interface is a set of general behavior? [duplicate]

I'm new to OOP. Can I say Interface is a set of general behavior that may be have and act uniquely by a set of objects that have in common? And Abstract class has similarity with Interface but it have ...
Hendy's user avatar
  • 11
1 vote
1 answer
2k views

How to generalize a classes that has identical function plus some additional function

I have some designing problems with my project. To illustrate my problem, I'll use the following two classes from my project. public class RAM_UserManagement{ private Map<int,User> userList; ...
Sas's user avatar
  • 111
42 votes
9 answers
4k views

Programming for future use of interfaces

I have a colleague sitting next to me who designed an interface like this: public interface IEventGetter { public List<FooType> getFooList(String fooName, Date start, Date end) ...
sveri's user avatar
  • 585