Designing functional and fluent API: example of the Visitor Pattern

Java Language

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.

Lambda Puzzlers

José Paumard

Independant (very)

Passionate about programming computers for over 20 years, Jose made his debut in assembler and C, C for SIMD parallel machines before adopting Java as an object-oriented language, indispensable to most major modern applications. He brings his expertise and capacity for analysis and synthesis to many projects, mainly in the lower layers, close to the data, but also on complex UI design, or in the browser. PhD in applied maths and computer science, assistant professor in Paris North University for 20 years, Java Champion, Java Rockstar, Jose also has a passion for education and knowledge transfer. He gives talks in major international Java conferences (JavaOne in San Francisco, Devoxx in Antwerp, Paris and London). He wrote numerous technical articles on Java technologies for Java Magazine, Oracle Technolgy Network. He writes a blog, Java le soir, French documentary source on Java technologies for thousands of french speaking developers around the world. He is a member of the french Paris Java User Group, and has been a co-organizer of the conference Devoxx France for three years.

Talks by tracksTalks by session typesList of SpeakersSchedule