“When to use interfaces, and when to use higher order functions?” came up in the review queue for reopening, under the pretense that it had been closed as primarily opinion based.
Edit: Based on some confusion that came to light in the comments, please note that this appeared as an audit in the reopen queue. The question was not actually closed. To me the question seemed on the borderline of being primarily opinion based. While I probably wouldn't have cast a close vote had I come across it, my vote to “leave closed” was based on the idea that “well, it's borderline, and if five people have already been convinced that it's opinion-based, I'll let that decision stand.”
The end of the question is:
Obviously the interface implementation has much less code, but it doesn't really feel like functional code anymore. If I start using interfaces throughout my web app, when do I know when to use higher order functions instead? - else I'll just end up with a plain old OOP solution.
So in short: When should interfaces be used, and when to use higher order functions? - some line has to be drawn, or it will all be types and interfaces, whereof the beauty of FP disappears.
The question text suggests that the question is about where a line should be drawn, based on how things feel, which seems primarily opinion based. A comment on the question links to a blog posting containing someone's thoughts on the matter, which suggests that it's opinion based. The accepted answer contains text that suggests it's largely an opinion as well:
I think using an interface is a good idea if you have more than 2 functions that are often passed to some other function together - this way, you avoid having too many parameters.
F# is a multi-paradigm language that combines functional and OO style, so I think using classes in this way is perfectly fine. (You can still benefit from the functional style when defining data types to represent the domain etc.)
One thing to keep in mind is that functional programming is all about composition. This might not be as useful in this case, but I always prefer writing code that I can compose to add more functionality rather than code that requires me to provide something when I want to use it.
I think your approach using a class that takes ICacheProvider is perfectly fine
This seems like a question that very well could have been closed as being primarily opinion based. It's not a bad question at all, and might seem at home on programmers.se or codereview.se, but what about it isn't too opinion based for SO? According to the closing reasons:
Many good questions generate some degree of opinion based on expert experience, but answers to this question will tend to be almost entirely based on opinions, rather than facts, references, or specific expertise.
I suppose this might be classified under “specific expertise,” but since the both the question and the accepted answer admit that the problem can be solved in either way, it seems like it would largely be a matter of taste. I could see this being answered along the lines of “this is where this coding conventions guide says to draw the line,” or “book X usually does it here, while book Y does it here,“ so that specific expertise or references might be pulled in.