Skip to main content
added 16 characters in body
Source Link
Billal Begueradj
  • 3.4k
  • 10
  • 25
  • 34

InterfaceInterface

Retrofit ImplementationRetrofit Implementation

ServiceCalls.javaServiceCalls.java

MainFragment:MainFragment:

Interface

Retrofit Implementation

ServiceCalls.java

MainFragment:

Interface

Retrofit Implementation

ServiceCalls.java

MainFragment:

Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Tweeted twitter.com/StackCodeReview/status/874944239813230592
Bumped by Community user
Bumped by Community user
edited tags
Link
200_success
  • 144.2k
  • 22
  • 188
  • 473
Bumped by Community user
Bumped by Community user
coding against interfaces is not a design pattern it is a principle, got the wording right
Source Link
oopexpert
  • 3.1k
  • 11
  • 17

Interface design pattern to have multiple implementations of network call libraries (Retrofit or Volley)

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?

Interface design pattern to have multiple implementations of network call libraries (Retrofit or Volley)

I am learning design patterns from Head First Design Patterns and the first pattern I came across is to "code to interface". Now I want to use that pattern in my Android app, which includes lots of API calls. I am using Retrofit for network calls.

I have used that design pattern considering some scenario something like this:

Have I correctly implemented that design pattern? 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?

Interface design to have multiple implementations of network call libraries (Retrofit or Volley)

I am learning design patterns from Head First Design Patterns and a principle I came across is to "code to interface". Now I want to apply this principle in my Android app, which includes lots of API calls. I am using Retrofit for network calls.

I have applied this principle considering some scenario something like this:

Have I correctly applied that principle? 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?

deleted 37 characters in body; edited title
Source Link
Jamal
  • 34.9k
  • 13
  • 133
  • 237
Loading
More specific title added
Link
Loading
Source Link
Loading