-
Notifications
You must be signed in to change notification settings - Fork 9
Reduce client module duplication #81
Comments
As for me it's normal for functional approach, where each function does well only one thing and developer need to compose this functions in a way, that is required. But you are correct - it looks like quite low level. I need also to think more about possible abstractions, that could hide this low level operations from library enduser. There could be opposite approach for eliminating duplication, but it also not ideal: |
I'd be more in favour of the former and not the latter in this case as it would couple the IO with the We can reevaluate at a later stage if this isn't the right abstraction but it's probably a good starting point? |
Is nice from a functional standpoint and seems quite common with Elixir libraries. There are some nice advantage to this apporach.
I am afraid that at some point someone will just write a wrapper that is simply a big Client module, but I guess that is there choice. |
Request.logout("http://base_url", token)
|> Client.do_request() Let's go with this for now, at the very least it will facilitate the development of the library. In light of what was said in #79, I'm happy for the |
As mentioned in #77, this issue was created to discuss the future architecture of the library.
From #77:
Agreed, duplication has been one of the greatest pain points of the project so far and reducing that by stripping down the
Client
module is probably the way to go. In my mind, theClient
has always been there to tie the non-io part of the library to the HTTP layer. I think a good first step might indeed be to move to this pattern:The downside which has stopped me from doing it thus far, is that two function calls would be necessary for each request. The
Client
module ends up being a thin wrapper for the configuredHTTPClient
which makes me wonder if it is even necessary. Thoughts?Good point, and yes, it is quite blurred. I'm not sure what the solution is here yet. My hunch is that the
Client
module should imply IO, and theRequest
module should not; this might be a helpful distinction to keep in mind to start reducing the coupling. This might also be cleared up once #78 is discussed?The text was updated successfully, but these errors were encountered: