Visitor design pattern helps adding an operation to be performed on the objects of different classes without changing these classes. But it's not a very intuitive solution, especially because of necessity of double dispatch.
As a Swift developer I like to use type extensions in separate file for this purpose. Am I loosing something important? Are there any situations where visitor design pattern is the right choice?
Aucun commentaire:
Enregistrer un commentaire