mardi 31 juillet 2018

design pattern issues with extended class and interface in Java

So I have this class called as BaseUtils. This is inherited by two classes now. But, in future it will be inherited by upto 5 or 6 classes. Let's call one of the child class as SubUtils.

This SubUtils implements an interface - UtilInterface.

I have four methods in UtilInterface:

sendRequest()
prepareHeader()
getClientId()
setClientId()

I implemented two methods (getClientId and setClientId) of this in the base class - BaseUtils. And the other two I implemented in SubUtils.

I somehow feel I made a design flaw.

Am I doing it the correct way?

Aucun commentaire:

Enregistrer un commentaire