Hacker News new | ask | show | jobs
by mquander 5926 days ago
OK, but why would you ever want to say, for example, "I use the strategy pattern here to pass a sorting mechanism into this other function" instead of "I pass a sorting function into the other function?" What utility does it have to think of such a thing in terms of a "strategy pattern?"

In Java, I guess it makes sense to have a separate concept for such a thing, since you can't pass around a function or a function pointer, so you need some wrapper code and some extra architecture in order to do it. But in a normal language, who cares about the pattern?