While we wait for CppCon 2015 in September, we’re featuring videos of some of the 100+ talks from CppCon 2014. Here is today’s feature:
Accept No Visitors
by Yuriy Solodkyy
Summary of the talk:
Visitor Design Pattern was an attempt to overcome a limitation of object-oriented languages - inability to retroactively introduce new polymorphic functions. While it was quite efficient in providing extensibility of functions, it was never truly retroactive, easy to teach, use or maintain, and it achieved this at the cost of hindering extensibility of classes, introduction of control inversion and requiring tons of boilerplate code to be written. Visitor Design Pattern is a workaround, not a solution to the problem and in this talk I would like to discuss a more elegant yet as efficient solution in the form of a Match statement. We will look at several use-cases for the Visitor Design Pattern, their encoding using both approaches and ultimately their advantages and disadvantages.