Design Patterns for Developing Dynamically Adaptive
Total Page:16
File Type:pdf, Size:1020Kb
Design Patterns for Developing Dynamically Adaptive Systems ∗ Andres J. Ramirez and Betty H.C. Cheng Michigan State University 3115 Engineering Building East Lansing, Michigan 48824 {ramir105, chengb}@cse.msu.edu ABSTRACT 1. INTRODUCTION As applications grow in size and complexity, and computing As applications grow in size, complexity, and heterogene- infrastructure continues to evolve, it becomes increasingly ity in response to growing computational needs, it is increas- difficult to build a system that satisfies all requirements and ingly difficult to build a system that satisfies all require- constraints that might arise during its lifetime. As a result, ments and design constraints that it will encounter during there is an increasing need for software to adapt in response its lifetime. Many of these systems are required to run con- to new requirements and environmental conditions after it tinuously, disallowing long downtimes where humans look has been deployed. Due to their high complexity, adaptive for places to modify the code. As a result, it is important programs are generally difficult to specify, design, verify, and to be able to adapt an application’s behavior at run time in validate. In addition, the current lack of reusable design ex- response to changing requirements and environmental condi- pertise that can be leveraged from one adaptive system to tions [21]. IBM proposed autonomic computing [16] to meet another further exacerbates the problem. To address this this need, where a system manages itself based on high-level problem, we studied over thirty adaptation-related research objectives from a systems administrator, thus promoting and project implementations available from the literature self-management and self-reconfiguration. Due to their high and open sources to harvest adaptation-oriented design pat- complexity, adaptive and autonomic systems are generally terns that support the development of adaptive systems. difficult to specify, design, verify, and validate [32]. In addi- These patterns facilitate the separate development of the tion, the current lack of reusable design expertise that can be functional logic and the adaptive logic. We present these leveraged from one adaptive system to another further ex- design patterns within the context of a modeling-based de- acerbates the problem. To address this problem, we studied velopment process for dynamically adaptive systems. In or- over thirty adaptation-related research and project imple- der to address the assurance of these adaptive systems, the mentations available from the literature and open sources patterns also include templates for formally specifying in- to harvest and develop adaptation-oriented design patterns variant properties of adaptive systems. that support the development of adaptive systems. This pa- per describes the harvested adaptation design patterns and how they can be used to construct adaptive and autonomic Categories and Subject Descriptors systems. Most adaptive systems, including autonomic systems, com- D.2.11 [Software Architectures]: Design Patterns; D.2.10 prise three key elements: monitoring, decision-making, and [Design]: Methodologies reconfiguration. Monitoring enables an application to be aware of its environment and detect conditions warrant- ing reconfiguration; decision-making determines what set of Keywords monitored conditions should trigger a specific reconfigura- Design Patterns, Adaptive Systems, Autonomic Systems tion response; and reconfiguration enables an application to change itself in order to fulfill its requirements. Not only must developers design and implement each of these ele- ∗This work has been supported in part by NSF grants CCF- ments correctly, they must also carefully determine their 0541131, CNS-0551622, CCF-0750787, IIP-0700329, and CCF-0820220, Army Research Office W911NF-08-1-0495, interactions. For instance, if the monitoring process fails to and the Department of the Navy, Office of Naval Research report a significant environmental change, then the decision- under Grant No. N00014-01-1-0744, Ford Motor Company, making process may incorrectly trigger an unnecessary (or and a grant from Michigan State University’s Quality Fund. even detrimental) reconfiguration. Unfortunately, until re- cently, most approaches have addressed adaptation using ad hoc techniques [10]. To address these concerns, researchers Permission to make digital or hard copies of all or part of this work for have developed adaptation-enabling frameworks [2, 9], mid- personal or classroom use is granted without fee provided that copies are dleware [18, 23], and language-based support [28]. These not made or distributed for profit or commercial advantage and that copies approaches, however, tend to be tightly coupled with spe- bear this notice and the full citation on the first page. To copy otherwise, to republish, to post on servers or to redistribute to lists, requires prior specific cific domains or technologies, thus limiting their applicabil- permission and/or a fee. ity with respect to the problem being addressed. Design ICAC ’09 Barcelona, Spain patterns, on the other hand, work at the modeling and de- Copyright 200X ACM X-XXXXX-XX-X/XX/XX ...$5.00. sign level of abstraction, thereby potentially increasing the pares our pattern-based approach with a framework-based amount of design reuse when compared to other approaches. approach. Lastly, Section 7 presents our main findings and This paper presents twelve adaptation-oriented design pat- discusses future directions of work. terns to facilitate the reuse of adaptation expertise. In the spirit of the original design patterns by Gamma et al. [8], 2. BACKGROUND each of the adaptation-oriented design patterns were devel- oped by generalizing several existing design solutions. For This section briefly introduces two key topics fundamental each design pattern, we use platform-independent models to this paper, design patterns and the model-based develop- to represent the solution. In addition, by focusing on the ment process by Zhang and Cheng [32]. recurring challenges found in monitoring, decision-making, and reconfiguration activities, our design patterns separate 2.1 Design Patterns the adaptive logic from the functional logic. This separation A design pattern is a general and reusable solution to a of concerns facilitates the reuse of adaptation designs across commonly recurring problem in design [8]. A software de- multiple applications and domains. Similarly, while harvest- sign pattern does not provide code, nor can it be directly ing each candidate design, we have observed recurring inter- transformed into code. Instead, a design pattern identifies actions between monitoring, decision-making, and reconfig- and abstractly models the key aspects of a common design uration processes. This information enables us to suggest structure that make it useful for creating a reusable object- which design patterns should be used together. Lastly, we oriented design. Each design pattern has four essential ele- extended the design pattern template introduced by Gamma ments [8]. A pattern name is a handle that can be used to et al. [8] with a Behavior and Constraints fields. Constraints describe a design pattern, its solutions, and consequences. contain specific templates that can be used to specify invari- The problem describes under what context to apply the de- ant properties that must be satisfied by state-based models sign pattern. The solution describes the elements that make from the Behavior field once the design pattern is instanti- up the design, their relationships, responsibilities, and col- ated. Since our approach is compatible with the high assur- laborations. Lastly, the consequences describe the results ance model-based development process for adaptive systems and tradeoffs of applying the design pattern. Each of these previously introduced by Zhang and Cheng [32], automated four essential elements are organized and presented in the verification techniques can be used to analyze the instan- design pattern template fields. tiated design patterns against functional and adaptation- specific properties. 2.2 Model-based Development Process Harvesting design patterns is a difficult and subjective Zhang and Cheng [32] previously introduced a model- task for two main reasons. First, it is impractical to ex- based development process with the objective of guiding the amine all available systems and research projects associated rigorous development of adaptive programs. The process with adaptation. Second, some of the surveyed systems had separates the adaptive behavior and the non-adaptive be- little to no documentation accompanying their design. To havior specifications of adaptive programs. By doing so, the ensure that the design patterns harvested were sufficiently respective models are easier to specify and more amenable to mature to aid developers in building adaptive systems, we automated analysis, visual inspection, and modification. As performed two forms of validation in this work. First, we Figure 1 illustrates, the process starts with high-level system found additional instances of our design patterns in other goals (G) and progresses through design models (Mi, Mj ) adaptive systems. In some cases, information from these to code. The focus of the process is the specification of key new instances enabled us to further generalize the solutions properties (e.g., Φi, Φj ) at each of the major development and refine the design patterns. Second, we re-engineered phases. While the original work used Petri-nets