Basic FastStats setup#211
Conversation
Thorinwasher
left a comment
There was a problem hiding this comment.
Mostly good, I do have some ideas on how it could be done in another way, but feel free to ignore them as your solution works fine as well.
There was a problem hiding this comment.
One way to make this more extensible is to have an interface type, i.e Metrics, and then have the types FastStats, BStatsBrewery, BStatsBreweryX implement that interface.
With that you could just store all the different metrics in a list, like this:
List<Metrics> metrics = List.of(new FastStats(), new BStatsBrewery(), new BStatsBreweryX());And then access those like this:
// Enable all metrics
metrics.forEach(Metrics::enable);
// Disable all metrics
metrics.forEach(Metrics::disable);Right now you essentially just have a wrapper class that does this, which does not scale as well. (Honestly does not matter, as this solution works on small scales, and it's probably not going to change)
| } | ||
| } | ||
|
|
||
| public void forDrink(Brew brew) { |
There was a problem hiding this comment.
Other stats being tracked like this could be done through another class, maybe a StatsCache, and then it could be accessed with the statistics clients.
Also this one is stupid, as I don't think it's being stored persistently. So this statistic is going to be directly related to server restarts.
No description provided.