Re: OO, I just don't get it.
From: Jan Ploski (jpljpl_at_gmx.de)
Date: 12/16/03
- Next message: Phlip: "Re: OO, I just don't get it."
- Previous message: Miguel Oliveira e Silva: "Re: Modules"
- In reply to: Val: "Re: OO, I just don't get it."
- Next in thread: Val: "Re: OO, I just don't get it."
- Reply: Val: "Re: OO, I just don't get it."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Tue, 16 Dec 2003 20:04:59 +0100
Val wrote:
> Is class "MyDocument" really neccessary within the scope of "Factoring
> Methods"? I was thinking like this:
> a) Make an abstract entitiy-creator.
> b) Derrive a concrete entitiy-creator for absstract-creator.
> c) Make THE entity.
> - Regarding "c": This thing is going to be added. The framework supports it,
> but that's obvious. But it shouldn't be relevant whether '' THE entity" is
> derrived from something or not.
>
> Am I right or is a super-class of "THE entity" an inherent aspect to
> "Factoring Methods".? Or in this case, with this code, is "MyDocument" a
> MUST?
They are called "Factory Methods". Factory in the sense of a producer,
not to be confused with "factoring" in the sense of dividing some whole
into pieces.
You ask whether the base class Document and a subclass MyDoucment are
essential to the pattern or if you could get away with just Document. My
opinion is that you could have just one product class and different
subclasses of the factory returning instances created in different ways.
I would still call the makeXXX method a "factory method", especially if
it is pure virtual in the base class. The makeXXX method can be used to
postpone to subclasses *how* the product gets created, not just *what
type* of product gets created, even if that latter use seems more common.
-JPL
- Next message: Phlip: "Re: OO, I just don't get it."
- Previous message: Miguel Oliveira e Silva: "Re: Modules"
- In reply to: Val: "Re: OO, I just don't get it."
- Next in thread: Val: "Re: OO, I just don't get it."
- Reply: Val: "Re: OO, I just don't get it."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|