A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
Spring in Action
this week in the
Architect Certification (SCEA/OCMJEA)
Builder Design pattern
Joined: Jun 13, 2002
Nov 21, 2005 12:47:00
Compact Computers is a small computer assembly company. Their online application allows customers to pick and choose accessories to build their own PCs. The accessories are:
i. Processor - 800Mhz, 1Ghz, 1.2Ghz
ii. HDD - 40 GB, 60 GB, 80 GB
iii. Memory - 128 MB, 256 MB, 512 MB
If a computer can have exactly 1 processor, 1 HDD and 1 memory stick, what
would be best used here?
A Factory Method
D Abstract Factory
Can somebody please explain why it the answer is Builder ?
Joined: Oct 30, 2005
Nov 21, 2005 15:09:00
I am sure you can understand why it needs to builder if see the example @
Joined: Nov 22, 2005
Nov 22, 2005 02:48:00
We should use the builder pattern here for the following reasons.
a) To separate the construction process of the computer from its representation. This gives us the better control to keep the assembling process separately from the end object type.
b) Because we need to assemble several kinds of computer propreties objects like CPU, Monitor etc but result in a different object type (like ComputerModel based on assembled properties).
I agree. Here's the link:
subject: Builder Design pattern
Building a computer yourself
Design Pattern: Confusing Questions !! Please help in answering....
Confusion regarding which pattern!
Builder vs Abstract Factory
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014