Pattern name: Growth Plan
Intent
Build your adaptive programs incrementally. Use structural
and behavioral simplifications which allows for growth
by addition and refinement.
Also Known As:
Evolutionary Development
Motivation
When developing a program, it is useful to have at all times
a simplified version (often a very simplified version)
of the program running. This is good for your self confidence
in your programming skills and it is good for your customers who
can see something running on which they can give you feedback.
Therefore we want to build applications in growth phases,
where a phase p can do more than a previous phase q.
However, this only works effectively if phase p can
reuse what phase q accomplished. A nice property
for a growth phase q is: if a program
runs for phase q then it will also run in a later phase p.
But this is sometimes not achievable.
We want to build p out of q by adding or refining q
and not by having to modify q. The following additions/refinements
are appropriate:
Class graph extending transformations:
(add parts, new classes, new subclasses, new parts, etc.)
See
http://www.ccs.neu.edu/research/demeter/biblio/LHX94-object-ext.html
for details.
Behavioral transformations:
add methods, traversals, visitors
refine methods and visitors
(adding visitors to traversals,
adding more visitor methods to visitor classes,
subclassing visitor classes)
refine traversals
(adding more constraints to traversal specifications)
Applications
Use the Growth Plan pattern when you build applications
involving more than 6 classes.
Solution
Structural and behavioral simplification which supports
growth by addition and refinement requires some experience
but is not hard to do. A good strategy is to build
a relative big chunk of the class dictionary of the application
and to test it with several input sentences. Then you
build a shrinking plan (whose inverse is a growth plan)
to construct a smallest class dictionary for which you can implement
some interesting behavior. You then first implement the simple
behavior for the small class dictionary and in later phases
you make class dictionary and behavior more complex.
Consequences
Following the Growth Plan pattern has a number of benefits:
1. Gradual building of confidence in your programming skills.
2. You can get early feedback from your customers by showing
them early prototypes.
3. Testing is simplified. If you get a bug in phase p then
check whether it already shows up in an earlier phase
where the situation is simpler. Using this approach
iteratively you can faster zoom in on the bug.
Implementation
This is a software development planning pattern.
Create separate directories for each growth phase
so that you can easily go back to earlier phases.
Document the increments from one phase to the next.
This is best done by a programming notation which supports
various forms of refinements:
See
http://www.ccs.neu.edu/research/demeter/biblio/dem-book.html
for explanation.
Known Uses
This pattern was used in the development of Demeter/Flavors,
Demeter/C++ and Demeter/Java.
Sample Code
This is a software development planning pattern.
Exercise:
Define a notation to express growth plans.
References
DEM:
@BOOK{karl:demeter,
AUTHOR = "Karl J. Lieberherr",
TITLE = "Adaptive Object-Oriented Software:
The Demeter Method with Propagation Patterns",
PUBLISHER = "PWS Publishing Company, Boston",
YEAR = "1996",
NOTE = "ISBN 0-534-94602-X"
}
GOF:
@BOOK{gang-of-4,
AUTHOR = "Erich Gamma and Richard Helm and Ralph Johnson and John Vlissides",
TITLE = "Design Patterns: Elements of Reusable Object-Oriented Software",
PUBLISHER = "Addison-Wesley",
YEAR = "1995"
}
==========================================================================
To other patterns of pattern language for AP
To Demeter home page
To Design Patterns Home Page