Soyez le premier à aimer ceci
This is the slide deck of my talk from Devoxx Belgium 2019. You can watch the video here https://www.youtube.com/watch?v=gq23w9nycBs and get the code here: https://github.com/JosePaumard/devoxx-belgium-2019-visitor-lambda.
Among the patterns from the GoF, the Visitor is probably the more complex to implement. One of the difficulties is that you need to implement it in your object model, leading to complex refactoring for legacy applications. Based on the use of all the nifty tools brought by functional programming: chaining, composition, and partial application, you can implement Visitors without having to change your object model, using a functional and fluent API. This approach can be used to implement other patterns: Builder and Validator. Using this way of designing API leads to readable and robust code, designed following the GoF patterns.