aspose file tools
The moose likes OO, Patterns, UML and Refactoring and the fly likes Builder design pattern Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Elasticsearch in Action this week in the Big Data forum!
JavaRanch » Java Forums » Engineering » OO, Patterns, UML and Refactoring
Bookmark "Builder design pattern" Watch "Builder design pattern" New topic

Builder design pattern

Ionut Puna

Joined: Jan 11, 2010
Posts: 1

I am new to design patterns, but willing to learn. So I came here for an advice, as this would be my first attempt in implementing the builder pattern.
The project: Create a java application that will generate and send via email 6 exports (Excel files) of different types, having their data filled from a database. The names of the exports, as well as other filters, will be read from an XML file passed as an argument in the command line.
My solution was to use the builder pattern, as it follows:






Can someone please tell me if this design is well thought? I would appreciate any help you can give me.

An other question: Keeping in mind that the XML with the requested filters is received as a argument in the command line, how can I have access to the filters in the ConcreteBuilder classes? it is a good design to pass the ExportFilters object as an argument to the constructor, like
new BuilderExportImplementationA (ExportFilters fe)
Also, the methods saveExport(String path) and sendExport(..) to which class will they belong?


ps: Please excuse my grammar, as english is not my native language.
Jan Cumps

Joined: Dec 20, 2006
Posts: 2531

Welcome to the Ranch, Ionut.

OCUP UML fundamental and ITIL foundation
youtube channel
jQuery in Action, 2nd edition
subject: Builder design pattern