I am learning design patterns from Head First Design Patterns and the first patterna principle I came across is to "code to interface". Now I want to use that patternapply this principle in my Android app, which includes lots of API calls. I am using Retrofit for network calls.
I have used that design patternapplied this principle considering some scenario something like this:
Have I correctly implementedapplied that design patternprinciple? If not, what changes do I need to make? In onCreate
of MainFragment
, I am hardcoding the implementation. How can the interface design pattern be better applied in this scenario?