I am developing an android application which is making a lot of network requests. I want to design my application in such a way that :-
-
All my network related tasks are centralised in one single class and whenever I want to make a request I should just instantiate that class and make my request. Basically I don't want to pollute my activities with network calls.
-
The design should be such that If in future I want to change the library that I am using for network calls(okhttp, retrofit, async etc) I dont have to do a lot of code change or if there is any code change they all must be in one class, activities should not be able to tell the difference. I should just be able to change the libraries I am using with minimal code change.
-
I want to follow the SOLID principles as much as I can.
-
The class should be unit testable. I should be easy to mock in case I want to test any other class that uses the parameters or methods of this class.
I have some ideas in my mind and I don't want any code examples, I just need some advice from you guys so that I can follow the best design practices from the very beginning of my app development.
Thank you
Aucun commentaire:
Enregistrer un commentaire