In his blog Lars started a series of articles about using the builder pattern (read here and here). He describes the main benefits of using this pattern for creating simple and complex data structures.
I'm asking myself: why is this pattern so rarely used? In my opinion this is due to the fact that it really bloats your code. I surely agree that the domain model classes are one of the most important parts of an application. But writing builders for each of these model classes is plain boring.
Fortunately IDEs are the lazy developers best friend. There is a tiny little Eclipse Plugin out there to let us auto-generate builders for arbitrary classes. The plugin works fine with the latest Eclipse Galileo. After installing the plugin from the update site you just have to open the desired class in the editor and then press Right-Click -> Source -> Generate Builder Pattern Code at the editor. Don't be surprised not to find this command neither in the menu-bar (Source) nor in the ALT + SHIFT + S source context-menu.


8 comments:
Aha :-)
Thanks for mentioning. It seems that there is a drastically boost in your blogging activities.
Btw, there's an issue with the design of the blog and the ability to post comments, at least for me with firefox & safari: the actual captcha text box is not viewable and just reachable when toggling with the focus with tab.
Hi Lars,
thanks for reporting this issue. Seems that I've accidently broken something. I hope everything should be fine, yet?
PS: Im infected by the blogging virus obviously. =)
The embedded comment form drives me crazy...
While everything is fine at home on vista (tested with firefox, chrome and ie) the form is not visible at my work on win xp (firefox).
For now Ive deactivated the embedded comment form.
This update URL no longer seems to work. Is there a new URL?
Thanks!
In reply to Marcus E, untick Eclipse dialog's "group items by category" and the plugin shows and still works fine. (thanks to plugin author!)
update site url does not work...
you can use fast code eclipse plug-in tutorial builder pattern code generator.
--Gautam
http://code.google.com/p/bpep/
Post a Comment