There aren't many drawbacks regarding the use of the NVI. That is why the guideline to always make virtual functions private, and use NVI to call them, is widely accepted. However, there are some considerations that you must be aware of when deciding whether the Template Method is the right design pattern to follow. Use of the template pattern may lead to fragile hierarchies. Also, there is some overlap between design problems that can be solved using the template pattern and the ones better served by the strategy pattern, or, in C++, policies. We will review both considerations in this section.
Drawbacks of the Non-Virtual Interface
Composability
Consider the earlier design for the LoggingFileWriter. Now, suppose that...