In this paper, we propose a new design pattern named Answerer whose purpose is to eliminate the effort of recompiling a program due to changes of run-time environments. Most programs have to behave differently to accommodate with various run-time environments. As usual, the behaviors of such programs have to be specified in conditional blocks. When the run-time environment of a program changes, these blocks need to be modified and recompiled.The Answerer pattern applies a reflection technique to take care of conditional execution. The reflection is an idea to provide programs with a mechanism for changing structure and behavior dynamically. Based on this idea, the Answerer pattern provides: (1) a model of conditional execution and specification rules, (2) a mechanism to structure a model dynamically from information acquired at run-time, (3) a mechanism to create and execute a conditional operation from a model created from (2). Firstly, we found that it is necessary for structural items of (1) to implement the following information in order to implement the Answerer design pattern based on the above model and mechanisms: (a) an information about environmental factors that should be observed (b) an information about behavior that should be executed according to the factors. Secondly, we created the Answerer design pattern that implements (2) and (3).In this paper, we explain how we applied and implemented the Answerer pattern with an example of Java applet of DVD authoring tool.
Index Terms:
object-oriented, design pattern, reflection architecture pattern, conditional execution, adaptable system
Citation:
Mari Omori, Nobuyuki Ikeda, Jun-ichi Yamamoto, "Answerer: A Design Pattern for Dynamical Conditional Execution," tools, pp.158, Technology of Object-Oriented Languages and Systems, 1999