Software design patterns: encapsulation & object identity
From: AB (apqs43_at_dsl.pipex.com)
Date: 12/08/04
- Next message: Daniel Parker: "Re: Software design patterns: encapsulation & object identity"
- Previous message: H. S. Lahman: "Re: Designing web form processing system"
- Next in thread: Daniel Parker: "Re: Software design patterns: encapsulation & object identity"
- Reply: Daniel Parker: "Re: Software design patterns: encapsulation & object identity"
- Reply: Mark Nicholls: "Re: Software design patterns: encapsulation & object identity"
- Reply: H. S. Lahman: "Re: Software design patterns: encapsulation & object identity"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 7 Dec 2004 16:52:05 -0800
Please consider a GOF Factory class (C++ implementation) that
constructs, maintains, and issues GOF Singleton instances of a Widget.
Clients of the Factory instance obtain the Widget Singleton instance
from the Factory.
Memory management is the responsibility of the Factory - the Widget
Singleton is destroyed by the Factory upon deletion of the Factory.
>>From a design-principle perspective:
1. Is it important for the Factory to publish (e.g. document on public
APIs) the fact that the instances issued to clients are Singletons? Or
should this information be 'kept secret' beyond the internal confines
of the Factory?
2. Similarly, might clients justifiably require unique non-Singleton
instances from a Factory for some particular type of Widget, or would
such a requirement represent an implementation constraint that the
client is not entitled to impose on the Factory?
3. What would be the most appropriate public API names(s) for the
Factory interface(s)? What would constitute a bad API name? Starter
candidates include GetWidget(), MakeWidget(), WidgetInstance(). I
anticipate the answer being partially related to 1 & 2.
- Next message: Daniel Parker: "Re: Software design patterns: encapsulation & object identity"
- Previous message: H. S. Lahman: "Re: Designing web form processing system"
- Next in thread: Daniel Parker: "Re: Software design patterns: encapsulation & object identity"
- Reply: Daniel Parker: "Re: Software design patterns: encapsulation & object identity"
- Reply: Mark Nicholls: "Re: Software design patterns: encapsulation & object identity"
- Reply: H. S. Lahman: "Re: Software design patterns: encapsulation & object identity"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|