Soulseek.NET icon indicating copy to clipboard operation
Soulseek.NET copied to clipboard

responseReceived in SearchOptions and in the signature of SearchAsync() are confusing

Open jpdillingham opened this issue 3 years ago • 0 comments

I confused myself with this briefly. The responseReceived in SearchOptions is an alternative to an event; there's a few of those throughout the library and I think they are beneficial and appropriately named.

The responseReceived argument of SearchAsync() is beneficial for sure, but I think the name could be improved to disambiguate the functionality from the options version.

A better name might be handleResponse, or maybe responseHandler, which would be more in line with how some of these other delegates are named.

There's basically three flavors within options:

  • resolvers: these are Funcs that take arguments and return something
  • nounPastTenseVerb: these are analogs for events. stateChanged, etc. they are fire and forget
  • things named to reflect their purpose. very similar (perhaps the same as) resolvers, these are in TransferOptions; governor, slotAwaiter, reporter

Within the public API of the library, there are a couple of Funcs:

  • outputStreamFactory: allows 'late binding' of I/O streams
  • inputStreamFactory: same as above

And then there's responseReceived.

All this being said (talking to myself here because it is going to be a while before I think about this again), responseHandler is the more semantically correct name.

This is a breaking change, and I'm definitely not going to rev the major version just for this; it will have to wait for the next update.

jpdillingham avatar Jul 16 '22 22:07 jpdillingham