Content deleted Content added
Added an article |
Added a section |
||
Line 13:
| accessdate = 2012-09-12
}}</ref> It is a pattern that is strongly related to the [[template method pattern]]. The NVI pattern recognizes the benefits of a non-abstract method invoking the subordinate abstract methods. This level of indirection allows for pre and post operations relative to the abstract operations both immediately and with future unforeseen changes. The NVI pattern can be deployed with very little software production and runtime cost. Many commercial software frameworks employ the NVI pattern.
== Benefits and detriments ==
A design that adheres to this pattern results in a separation of a class interface into two distinct interfaces:
# Client interface: This is the public non-virtual interface
# Subclass interface: This is the protected (non-)virtual interface.
With such a structure, the [[Fragile base class|fragile base class]] interface problem is mitigated. The only detriment is that the code is enlarged a little.<ref>{{cite web
| url = http://cpptruths.blogspot.co.at/
| title = Non-Virtual Interface (NVI) idiom and the design intent
| last1 = Tambe
| first1 = Sumant
| authorlink1 = https://plus.google.com/117220997561739301261
| date = 2007-04-11
| work =
| publisher = C++ truths
| archiveurl = http://cpptruths.blogspot.co.at/2007/04/non-virtual-interface-nvi-idiom-and.html
| archivedate = 2007-04-11
| quote =
| accessdate = 2012-09-12
}}</ref>
== References ==
{{Reflist|2}}
<!-- Moved from the [[Template method pattern]] to here -->
Line 21 ⟶ 42:
<!-- Categories -->
[[Category:Software design patterns]]
[[Category:Articles with example Java code]]
[[Category:Method (computer science)]]
<!-- Interwikis -->
|