Re: abstract factory -- a doubt ?



viveklinux@xxxxxxxxx wrote:

new to OO and was wondering what other kind of design principle
violations does an Abstract Factory prevent other than OCP ?

Duplication. Without the factory, then there are lots of 'new' statements
scattered around, and sometimes there are more 'if' statements that detect
a type code. The factory converts type codes to real types, in one place,
and this lets client code use the types without so many 'if' statements.

--
Phlip
http://www.greencheese.org/ZeekLand <-- NOT a blog!!!
.



Relevant Pages

  • Re: Downcasting - whats the problem?
    ... type identifier and based on that identifier chooses a factory object. ... The OCP protects us from rigid systems, systems which are hard to extend. ... associated factories without having to touch the generic algorithm at all. ...
    (comp.object)
  • Re: Downcasting - whats the problem?
    ... > type identifier and based on that identifier chooses a factory object. ... I would design the code to be as easy as possible to be used by any ... >> relevance of OCP ... RCM's downcast without based on a heuristic that takes no account of ...
    (comp.object)
  • Re: abstract factory -- a doubt ?
    ... Factory does prevent violations of OCP. ... related types that the factory is supposed to create, ... Abstract Factory... ...
    (comp.object)