Some weeks ago, I read the post referenced in a tweet. In short, the article provides two ways to generate the boilerplate code required by the Builder pattern: Lombok, to generate code at compile time and the Spark Eclipse plugin, to generate code at development time. However, I already wrote about the Builder pattern. And it’s a bit more complex than what’s described in the referenced post.
I guess many people know about the Visitor design pattern, described in the Gang of Four’s Design Patterns: Elements of Reusable Object-Oriented Software book. The pattern itself is not very complex as many design patterns go. I’ve known Visitor since ages, but I’ve never needed it… yet. Java handles polymorphism natively: the method call is based upon the runtime type of the calling object, not on its compile type.
The Builder pattern has been described in the Gang of Four Design Patterns book: The builder pattern is a design pattern that allows for the step-by-step creation of complex objects using the correct sequence of actions. The construction is controlled by a director object that only needs to know the type of object it is to create.
A design pattern in architecture and computer science is a formal way of documenting a solution to a design problem in a particular field of expertise. — Wikipedia Design patterns are a common reference in our line of work. People who discuss a pattern often draw strange looks from people who don’t about it (or who don’t know about patterns in general). Of course, there are dozens and dozens of design patterns just waiting for us to know them. IMHO, today, the three follo