I
iksrazal
I was having a friendly discussion with another developer, who did
something like:
public interface MyInterface
{
public List getMyList(int myInt);
}
public class MyInterfaceImpl implements MyInterface
{
// composition
protected MyProtectedClass myObject;
public List getMyList(int myInt)
{
myObject.findList(myInt);
}
}
The developers point was that since this class will be used by several
different clients, it is possible that in the future someone may
decide to use 'extends' on MyInterfaceImpl, and so any internal class
using composition should be protected.
Agree or disagree? Care to explain why?
iksrazal
something like:
public interface MyInterface
{
public List getMyList(int myInt);
}
public class MyInterfaceImpl implements MyInterface
{
// composition
protected MyProtectedClass myObject;
public List getMyList(int myInt)
{
myObject.findList(myInt);
}
}
The developers point was that since this class will be used by several
different clients, it is possible that in the future someone may
decide to use 'extends' on MyInterfaceImpl, and so any internal class
using composition should be protected.
Agree or disagree? Care to explain why?
iksrazal