Earlier quoted context omitted.
> You can still break up your algorithm into a class with multiple template methods Template methods are an abomination. They are only widely used because many OO languages don't have first-class functions. A template method means that the method is being parameterized by one or more functions. Parameters should be expressed as parameters ! You wouldn't design a Circle class so that you need to subclass it to specify…
> Furthermore, it is not safe to override a method without knowing if it has been designed for overriding, and what the class expects of the overriding method. This is true, but likewise, its not safe to parameterize functionality by passing callbacks unless you know what the function you are passing the callback to expects of callback functions (in terms of arguments, return values, and side effects.) Both of these,…
Of course; this goes without saying. But when programming in an OO style, programmers often override methods thinking that they are only changing the behavior of that one method, when in fact they could be inadvertently changing the behavior of other methods in the class.
When passing in functions as arguments, on the other hand, this makes it much more explicit what is supported and what isn't.