samedi 19 août 2017

Scope of a class in terms of Interface design principles

I've been working with c# for quite a while now. I am facing a rather silly issue.

My Situation

I have 3 methods with multiple overrides of each namely getAutosuggestData , getNearbyData and getLocationDetailsData. Now they all come under the case of search of location. I have 2 questions regarding structuring my code in a standard way:

Question 1

To have decoupled code, it's recommended to program to an interface, in such a case scenario that i have multiple overrides to a single method, should I put all my override method signatures into the interface as well? or should I simply avoid interfaces?

Question 2

Since I have a single case scenario i.e search of a location, should all the 3 methods getAutosuggestData , getNearbyData and getLocationDetailsData be implemented into a single interface followed by a single class implementation of the interface? Won't this break the S.O.L.I.D principles?

Does anyone have a better understanding of such a design structure where in my App is talking to a Library, the library has a service handler that implements the interface that has all the overrides to the above mentioned 3 methods. Because doing so would break the SOLID principles?

Sorry for the silly question, I know the rules of the forum and I request a bit of leniency here as I am just failing to understand this basic implementation.

Aucun commentaire:

Enregistrer un commentaire