gang-of-4-patterns AT lists.siebelschool.illinois.edu
Subject: Design Patterns discussion
List archive
- From: "Prabodh Saha" <prabodhs AT ivycomptech.com>
- To: gang-of-4-patterns AT cs.uiuc.edu
- Subject: [gang-of-4-patterns] Factory Method and Loosely Coupled Code
- Date: Tue, 18 Nov 2003 12:50:22 +0530
- Importance: Normal
- List-archive: <http://mail.cs.uiuc.edu/pipermail/gang-of-4-patterns/>
- List-id: Design Patterns discussion <gang-of-4-patterns.cs.uiuc.edu>
The point of discussion is
~~~~~~~~~~~~~~~~~~~~~~~~~~
How does Factory Method promote loosely coupled code?
Following are some points coming to my mind. Please add to it.
1. Factory Method pattern provides a strong binding between the
"creator" and the "product".
The code designer can use this fact to cluster the strongly related
objects together [using (Factory) Methods in the creator object] and
decouple the client application from the strong cluster.
Then the client code can only hold a reference to a generic
creator object (say the root object/interface of the creators'
class hierarchy). The actual creator can be loaded at runtime
and get referenced by the generic-creator-reference present in the
client.
2. I have a question here, can you give me a scenerio where a "product"
of the Factory Method pattern should be used as a creator in turn
(thus forming a chain which can extend), rather than having more than
one (factory) methods in the primary creator itself ?
I mean should we ever need n-level deep factory method structure
rather than one-leve deep - as discussed in GOF?
If yes when, and if not why not ?
Regards,
Prabodh
<<attachment: winmail.dat>>
- [gang-of-4-patterns] Altering a Strategy....does this seem right?, Chris Finlayson, 11/15/2003
- Re: [gang-of-4-patterns] Altering a Strategy....does this seem right?, A Rick Anderson, 11/15/2003
- [gang-of-4-patterns] Factory Method and Loosely Coupled Code, Prabodh Saha, 11/18/2003
- RE : [gang-of-4-patterns] Factory Method and Loosely Coupled Code, Mikal Ziane, 11/18/2003
- [gang-of-4-patterns] Factory Method and Loosely Coupled Code, Prabodh Saha, 11/18/2003
- Re: [gang-of-4-patterns] Altering a Strategy....does this seem right?, A Rick Anderson, 11/15/2003
Archive powered by MHonArc 2.6.16.