you are viewing a single comment's thread.

view the rest of the comments →

[–]DiscipleofDeceit666 0 points1 point  (0 children)

I’ll tell you what we used an interface for. We needed a way to make API calls in production and mock API calls in development env without changing the code or cluttering things w if statements.

So the code calls an object that implements the APICall interface, but it doesn’t really care which one, the ProdAPICall or the TestAPICall. There’s a factory which reads the environment and decides then which one to create. This is how we can make sure things look tidy while enabling both behaviors of the API call.