davezych / shience

A .NET port(ish) of Github's Scientist library. (https://github.com/github/scientist)
MIT License
9 stars 1 forks source link

Refactor Publisher to functional pattern #16

Closed MovGP0 closed 8 years ago

MovGP0 commented 8 years ago

The publisher should not be a Functor (= class with single method; very old school), but a function (modern functional pattern).

Instead of:

Shience.Shience.SetPublisher(new MyPublisher());

The user should write something like:

Shience.Shience.SetPublisher(result => Log.Warn(...));
Shience.Shience.SetPublisher(MyPublisher.Publish);

The interface IPublisher would become obsolete.

davezych commented 8 years ago

:+1:

So something like:

void SetPublisher(Action<Results> publish)

?

davezych commented 8 years ago

Implemented in #13. Closing.