3 ms·
There are two ways of abstracting out an external api, one is via an interface with a set of methods this is well understood but there is another option as well
by aszen 6y ago
There are two ways of abstracting out an external api, one is via an interface with a set of methods this is well understood but there is another option as well that is to focus on the core data types your application needs. Create those types and then revolve your whole application logic around them.
Finally create decoders that instantiate those types from different sources.
- stepbeek 6y agoThis sounds interesting. Can you link to any examples?
- aszen 6y agoGo through https://fsharpforfunandprofit.com/fppatterns/ https://fsharpforfunandprofit.com/fppatterns/ And https://fsharpforfunandprofit.com/posts/13-ways-of-looking-at-a-turtle/ https://fsharpforfunandprofit.com/posts/13-ways-of-looking-a... I'm still learning on how to apply these ideas in my own work (which doesn't use f sharp or functional programming) but it's a rich source of ideas