Design patterns in the 21st century
Looking to simplify your design patterns? Take a look at this helpful overview of the classic design patterns and how functions can simplify your design and make your results cleaner and shorter.
With the advent of lambdas in Java 8, functional programming truly has returned to the mainstream, sitting proudly alongside its object-oriented brother. We now have the tools to create applications that use the best of both paradigms, but our knowledge and understanding of the concepts under the hood needs to catch up.
For years, we’ve relied on design patterns to guide us to solutions that are clean, simple and practical, but many of the classic OO design patterns laid out in the Gang of Four’s book are actually workarounds for the lack of functional programming constructs such as lambdas and higher-order functions.
With new tools at our disposal, we can simplify the majority of design patterns, using pure functions to reduce the proliferation of classes that are used once and thrown away. By removing the boilerplate surrounding our code, we focus on the most important part: the behaviour.
In this session recorded at the JAX London 2014, software craftsman Samir Talwar leads us through the classic design patterns, as well as some more contemporary object-oriented principles, showing you how functions can drastically simplify your design, leading to code that is cleaner and more concise.