carwow/umbra

Clean up go shadower

CGA1123 opened this issue ยท 2 comments

A couple of points raised in review:

  1. Should the pubsub and channel be setup inside the dispatcher?
  2. Should the dispatcher and reporter also have Start/Stop functions?
  3. The pool doesn't knows about the reporter and pushes results into a channel which the reporter consumes, but the dispatcher knows about the reporter and the pool and just calls functions on both. Should (option 1) the pool also call a function on the reporter (requires moving the Result struct into the reporter), or (option 2) the dispatcher just pushes requests into a channel (without knowing about the pool)? Option 2 is interesting for decoupling the components, but option 1 is the more tradition approach on other languages and may make the flow of data more easy to follow. ๐Ÿค”
  4. Should the report function in main be inside the reporter? (Specially if the reporter has Start function). We could then have different implementations of a reporter, e.g. ConsoleReporter, WebReporter (this one could start a web server and show the stats in a webpage for example). I think here I am also being influenced by the name, we probably have two interfaces, e.g. one would be responsible for displaying the stats (Reporter), and one would be responsible for collecting the stats (ResultsCollector). ๐Ÿค” At the moment, the second one is called Reporter, but not sure if it is the best name. The first one is just implemented in the main file.

I think i've addresed most of these in 2c9a43b although still no addition of a 'proper' reporter yet ๐Ÿ˜„

Nice! Probably fine to close this now ๐Ÿ˜„ If the reporter thing is important it will come up again, the straightforward implementation looks good now and the Collector responsability and naming makes sense. ๐Ÿ‘