Re: abstract factory -- a doubt ?
- From: viveklinux@xxxxxxxxx
- Date: 25 Apr 2006 16:32:52 -0700
daniel_t@xxxxxxxxxxxxx wrote:
Now that the set-up is done, I'll explain what I mean by "open up every
sub-class of the Factory and even the Abstract Factory itself."...
Suppose word from on high says our game now includes Artillery objects.
Now we also have Artillery, ArtilleryA, ArtilleryB, &c. This means the
Abstract Factory, and every sub-class of the factory needs a new method
"createArtillery"... Every sub-class of Factory needs to be modified,
as well as the AbstractFactory itself to accommodate this change. A
clear violation of the open-closed principle.
Are there ways to get around such a problem? Only if you use a
different creational pattern., however if you don't expect that such a
thing will happen, the AbstractFactory may be the best solution.
thanks. yes. it makes sense. guess it also corelates to the gang of
four book when they state that "supporting new kind of products is
difficult."
.
- References:
- abstract factory -- a doubt ?
- From: viveklinux
- Re: abstract factory -- a doubt ?
- From: Daniel T.
- Re: abstract factory -- a doubt ?
- From: vivekaseeja
- Re: abstract factory -- a doubt ?
- From: daniel_t
- abstract factory -- a doubt ?
- Prev by Date: Re: abstract factory -- a doubt ?
- Next by Date: Class design question
- Previous by thread: Re: abstract factory -- a doubt ?
- Next by thread: Re: abstract factory -- a doubt ?
- Index(es):
Relevant Pages
|