Part of the
ObjectBasedProgramming pattern language. Discussion occurs on
FamilySplitDiscussion.
Original at
http://www.geocities.com/SiliconValley/Foothills/5962/familysplit.htm
This pattern is under development.
Intent
Provide a strategy to design space efficient instance data.
Motivation
Instance data designed with the application of the
FamilyFusion pattern can be very space-inefficient under some circumstances. A more space-efficient design is required.
Applicability
Use the
FamilySplit pattern when
- Objects are instantiated from multiple concrete subclasses in a class family, and the subclasses do not share a majority of attributes, and space inefficiency is not acceptable.
Solution
The attributes common to all subclasses (or a significant portion) are stored in the primary instance data structure. Creation of auxiliary instance data structure to store the sub-class specific information.
Extreme case - each subclass would have its own data structure
Consequences
The
FamilySplit pattern has three important consequences:
- Require more sophisticated buffer management.
- Higher complexity in the polymorphic function.
- Lower memory consumption.
Sample Code
This section is to be filled in.
Known Uses
This section is to be filled in.
Related Patterns
This pattern provides a strategy to design the instance data introduced by the
InstanceData pattern.
The
FamilyFusion pattern describes a different technique to design the instance data structure for a class family.