Summary
In this chapter, we learned about the importance of the runtime environment and the dynamic nature of program execution. Behavioral design patterns can improve a program’s interaction with the internal parts of the Java platform. The JIT compiler can handle dynamic bytecode translation at runtime better, or a garbage collector can perform more efficient memory reclamation.
Most of these design patterns comply with SOLID principles – only the visitor pattern has left some room for thought. However, recently added improvements to the Java platform can help overcome this. Whether sealed classes, switch
statements, pattern-matching enhancements, or records, the platform provides a solid foundation for strengthening the program’s immutability and code stability and simplifying the use of design patterns. Some of them may come out of the box, such as a factory method and switch-case
statement enhancements.
In this chapter, we learned how to solve challenges...