E
Edward A Thompson
I have been reading on Java design practice, especially the arguments
for using interfaces rather than inheritance (composition vs
extension). I understand the reasons one would want to use an
interface rather than inherit form a parent class, but I have concerns
-
Since an interface does not have code, if multiple classes need to
implement the same interface, doesn't that mean I will be writing the
same methods for each, methods which might be identical?
Doesn't this encourage the bad practice of cut and paste coding and
the implied maintenance nightmare?
Interested in your thoughts
for using interfaces rather than inheritance (composition vs
extension). I understand the reasons one would want to use an
interface rather than inherit form a parent class, but I have concerns
-
Since an interface does not have code, if multiple classes need to
implement the same interface, doesn't that mean I will be writing the
same methods for each, methods which might be identical?
Doesn't this encourage the bad practice of cut and paste coding and
the implied maintenance nightmare?
Interested in your thoughts