Section 26.1. KNOWLEDGE-DRIVEN WEAVING


26.1. KNOWLEDGE-DRIVEN WEAVING

An ideal tool for aspect-oriented development would allow designers to describe the required functionality for a specific application along with its associated aspects and would then automatically generate the desired application.

Unfortunately, existing technologies are far from providing that kind of assistance. At the current stage of research, an intermediate approach is to have a tool with some core knowledge prescribe to the user which activities should be done to implement a given application. This leads us to the smart-weaving concept [8]. Essentially, developers specify their designs through generic aspect models, and then a special engine translates these models to programs in a specific aspect environment. In particular, frameworks [10] are a natural fit for this mechanism. Similarly, software agents [3, 21], and specifically, intelligent personal assistants [14], appear to be an interesting alternative for helping developers with framework instantiation. Basically, these assistants can observe human users or interact with them, using the information they glean to make suggestions or even directly alter the result of computations. These agents can employ techniques such as planning [20] to achieve their goals. An agent with adequate knowledge about the different functions that can be implemented using a target framework could guide developers with the programming steps required to implement such functionality. Our idea thus is to provide agent-based guidance for the instantiation of aspect-oriented frameworks. An outline of the proposed architecture is shown in Figure 26-1.

Figure 26-1. Assisting instantiation of aspect frameworks using the Smartbooks approach.


The process of framework instantiation can be seen as a composition of relatively simple programming activities. However, these activities must be carried out in a meaningful order. The difficulty resides in determining which activities have to be executed for creating a given application and how these activities can be combined to obtain the desired functionality. Pursuing this idea, we have developed an experimental tool, Hint, for framework instantiation [15]. Hint shows the user what functionality can be implemented using the framework, allowing the choice of functionality required for the application being implemented. Depending on the selected functionality, Hint elaborates a plan of activities to implement a concrete application. It then guides the user through the instantiation process by effectively executing these activities.

Documentation knowledge is described through predefined instantiation schemes that form part of the Smartbooks documentation method. In the next subsections, we briefly explain the Smartbooks method and the corresponding engine.

26.1.1. The Smartbooks Documentation Method

The Smartbooks method treats the overall instantiation of a framework as a sequence of basic instantiation tasks such as class specialization and method overriding. The framework designer describes the functionality provided by the framework and how this functionality is implemented by different framework components and provides rules that constrain the ways the framework can be specialized. This knowledge is represented in instantiation schemes. The purpose of these schemes is twofold. On one hand, the framework user employs these rules to express the intended functionality of his new application. The user is thus oriented towards defining what his application is supposed to do. On the other hand, the Smartbooks engine uses these requirements and the schemes documenting a target framework to guide the user through the process of application development.

Instantiation schemes can be graphically specified using a UML extension called TOON (Tasks and Object-Oriented Notation) to express framework structures and instantiation activities associated with them.

26.1.2. Programming Tasks in Smartbooks

The schemes of the Smartbooks method are directly associated with the concept of tasks, programming activities to be carried out by the developer in order to use or specialize a given set of components in the process of implementing a specific function. The execution of these tasks yields either code implementing the desired functionality or a code template to be completed by the programmer.

Smartbooks tasks are classified as pending or waiting tasks according to their role in the planning process. For example, if the planner finds that the implementation of a given functionality requires the specialization of a component plus overwriting certain methods, the corresponding activities are pending tasks (see Table 26-1). The user executes these tasks after an instantiation plan is generated by the tool.

Table 26-1. List of Pending Tasks Supported by Smartbooks

Task

Description

DefineClass

Adds a new class definition (from an existing base class).

DefineMethod

Adds a new method to a given a class.

DefineAttribute

Adds a new attribute to a given class.

UpdateClass

Modifies the definition of a class.

UpdateMethod

Modifies the definition of an attribute.

ImplementInterface

Makes a class implement a given interface.

Warning

Displays a message explaining a framework constraint.


The second type of task, waiting tasks (see Table 26-2), represents decisions required to continue planning. When the planning algorithm finds a waiting task as a precondition of a desired effect, it creates the task and then suspends itself. Once the user completes the task, the algorithm resumes. For example, the user would need to select between a composition or inheritance mechanism when creating a new proxy component.

Table 26-2. List of Waiting Tasks Supported by Smartbooks

Task

Description

AskSelection

Presents several alternatives and asks the user for a choice.

GetUserInput

Asks the user to enter a string.

SelectClass

Asks the user to specify a class.

SelectMethod

Asks the user to specify a method for a class.

SelectMethods

Asks the user to specify a set of methods for a class.


26.1.3. The Smartbooks Engine

As mentioned previously, a specific tool is in charge of collecting all the Smartbooks documentation and assisting the user through the process of framework instantiation. The architecture of this tool comprises several components with different responsibilities [15, 16]. The main components are:

Documentation tool. The documentation tool is used by framework developers to write framework documentation. This documentation corresponds with instantiation schemes, which are internally represented as Prolog rules.

Functionality collector. The functionality collector is a wizard for helping the user describe the functionality required for the application being developed. This functionality is again expressed as Prolog rules.

Planning Engine. The Planning Engine uses least-commitment planning techniques [20] to build instantiation plans.

Task Manager. The Task Manager keeps track of the tasks involved in instantiation plans. It is responsible for coordinating the execution, interruption, and cancellation of tasks.

The planning agent takes a list of functional requirements (written as instantiation schemes) and elaborates a list of required instantiation tasks based on the core knowledge provided by the framework designer. During the planning phase, the tool uses a UCPOP-like [18] algorithm called PHint. It follows the least-commitment principle. That is, it produces a partially ordered sequence of tasks, delaying decisions as much as possible. This flexibility allows the framework user to delay choosing task execution alternatives until they are needed.

The PHint planning algorithm is an enhanced version of the original planning algorithm presented in [15]. PHint is able to take advantage of TOON diagrams. It incorporates this information to prune the number of action choices. The instantiation tasks defined in these diagrams are seen as partially instantiated action sequences that should be met by the final plan according to the framework prescriptions, thus avoiding unnecessary work during planning.



Aspect-Oriented Software Development
Aspect-Oriented Software Development with Use Cases
ISBN: 0321268881
EAN: 2147483647
Year: 2003
Pages: 307

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net