Origin: |
Grand 98 |
Reason: |
Decide at run-time which particular class, implementing a specified
interface, to load and use.
|
Synopsis: |
Use Java's URLClassloader or Class classes
to load a class on demand.
|
Example: |
A food processor with a very large number of programs
loads these programs dynamically from a mass storage device.
|
Solution: |
Environment |
There is both an interface and a concrete class.
It load the LoadableClass which in turn
may call methods of the Environment.
|
LoadableClass |
There is both an interface and one or more concrete classes.
It has methods to set the Environment and
start the execution.
|
|
See also: |
VirtualProxy
(to hide that loading is dynamic)
AbstractFactory
(for the selection of the concrete loadable class)
|