| Author |
Examples for Builder and ProtoType
|
Sujatha Kumar
Ranch Hand
Joined: Jan 05, 2004
Posts: 134
|
|
Hi, Can anyone let me know, where could i find the examples for Builder and ProtoType pattern. Your help is highly appreciated. Regards Prathap.
|
SCJP,SCWCD,SCBCD,SCEA Part I
|
 |
steve souza
Ranch Hand
Joined: Jun 26, 2002
Posts: 852
|
|
|
The java clone() method is an example of the prototype pattern. the definition of prototype is: "Specify the kinds of objects to create using a prototypical instance, and create new objects by copying this prototype". This is what the java clone() method does.
|
http://www.jamonapi.com/ - a fast, free open source performance tuning api.
JavaRanch Performance FAQ
|
 |
Sujatha Kumar
Ranch Hand
Joined: Jan 05, 2004
Posts: 134
|
|
Can i have an example for a Builder. Regards
|
 |
steve souza
Ranch Hand
Joined: Jun 26, 2002
Posts: 852
|
|
Builder definition from Gang of 4 - Separate the construction of a complex object from its representation so that the same construction process can create different representations. Here is a link: http://www.fact-index.com/b/bu/builder_pattern.html Some of the creational patterns are a little blurry to me. I created a class called ArraySQL that allows you to type in a sql string and I parse that String to create the appropriate objects behind the scenes. The developer that uses my class has no idea what objects I create from there request. I think that fits the builder pattern as described above, but most examples don't use parsed Strings to build objects on the fly, so I'm not sure if it is the builder pattern or not. Here is an example of ArraySQL. Note that different objects are created behind the scenes depending on whether a display column is a function or wha t type of where clause is being used i.e. in, =, <=, != etc.
|
 |
 |
|
|
subject: Examples for Builder and ProtoType
|
|
|