A Case-Based Approach for Reuse in Software Design
3.4 CBR Engine
The cognitive functionalities of REBUILDER are supported by the CBR engine. It comprises six submodules, each one implementing a different cognitive process. These
char
Figure 3.7: Part of the data taxonomy used in REBUILDER.
cognitive processes can be combined in several ways. Figure 3.8 presents a possible sequence of use for these cognitive processes. The CBR engine submodules are:
Retrieval
Figure 3.8: One possible combination of the CBR engine modules.
Retrieval: The retrieval submodule selects from the case base a set of cases ranked by similarity with the designer’s query. It enables the software designer to browse through the most similar designs in the case library, exploring different design alternatives and reusing cases. This module works like an intelligent search assistance, which starts retrieving the relevant cases from the case library and then ranks them. The cases are ranked before being presented to the designer.
Figure 3.9 presents an illustration of the retrieval process, which is detailed in section 4.1.
Analogy: The analogy submodule generates new solutions using analogical reason-ing. This involves selecting a candidate from the case library, then mapping it with the query diagram, and finally transferring knowledge from this source case to the problem diagram, yielding a new diagram (see figure 3.10). This
CHAPTER 3. A Case-Based Approach for Reuse in Software Design
Figure 3.9: The retrieval process in REBUILDER.
mechanism generates solutions using only one case, which constraints the type of designs that it can generate. See section 4.2 for a detailed description.
Target
Figure 3.10: An illustration of the analogical reasoning process in REBUILDER.
Design Composition: The design composition submodule also generates new so-lutions from cases in the case library (see figure 3.11). The main difference to analogy generated solutions is that it can use more than one case to generate a solution. This mechanism can select pieces of cases and then compose them in a new diagram, yielding a solution to the designer’s query. See section 4.3 for details.
Figure 3.11: The design composition process in REBUILDER.
Design Patterns: The design patterns module can be used to generate new class diagrams based on the application of software design patterns (see figure 3.12).
It is used a CBR approach to select which design pattern to apply, and how it should be applied. Alternatively, the user can select a design pattern to be applied to a diagram. The application is then performed automatically by REBUILDER through the use of pattern operators. REBUILDER acquires new DPA cases from the user interaction, see section 4.4 for a complete description.
Target
Figure 3.12: A generic view of the design pattern module functioning in REBUILDER.
Verification and Evaluation: This module comprises two functionalities: verifica-tion and evaluaverifica-tion. While verificaverifica-tion checks the design coherence and correct-ness (see figure 3.13), the evaluation mechanism is used to assess the design’s properties. The verification can be used in combination with analogy or design composition to look for errors in the generated solution and to correct them.
The evaluation mechanism is at the designer’s disposal to judge the design properties, trying to identify shortcomings in the design. Both processes are presented in more detail in section 4.5.
New
Figure 3.13: The verification process in REBUILDER.
Learning: The learning submodule implements several case-based maintenance strategies that can be used by the KB administrator to manage the case library.
This module presents several measures to assess the case library performance, which provide an important advice to the administrator regarding the addition or deletion of cases (see figure 3.14). These strategies will be detailed in section 4.6.
There is also another module, which is the word sense disambiguation module, which is used when REBUILDER needs to associate a synset with a software object (see figure 3.15). This module receives a software object and a diagram, and returns a synset for the given object. The selection is based on several word sense disambigua-tion methods, which are described in secdisambigua-tion 4.7.
CHAPTER 3. A Case-Based Approach for Reuse in Software Design
Figure 3.14: The process of case base maintenance in REBUILDER.
NAME
Figure 3.15: The word sense disambiguation process in REBUILDER.
CBR Engine
This chapter describes the various reasoning modules of the CBR engine. Each mod-ule has a specific function in the reasoning cycle of CBR (see figure 3.8), though some of them come from different reasoning paradigms. The CBR methodology provided the framework for an integration of these various reasoning mechanisms. There is a module that is transversal to the CBR cycle, and it is not shown in REBUILDER’s architecture. It is the word sense disambiguation (WSD) module, which has the func-tion of associating a synset to a software object. This module can be used at any phase of the process, depending on the reasoning needs.
We start this chapter describing the retrieval module, ending with an example, which illustrates the functioning of this module. The second section describes the ana-logical reasoning module and how new diagrams are generated using analogy. This section also ends up with an example. Section three describes the design composi-tion module, which is an alternative to the analogy module. Seccomposi-tion four describes our CBR approach to the application of software design patterns, and presents an example of how this module can help design evolution. The next section describes the verification and evaluation module. Section six describes the case base mainte-nance (CBM) strategies used in the case learning module, and finally section seven concludes this chapter presenting the word sense disambiguation (WSD) process and the various disambiguation methods implemented in REBUILDER.
CHAPTER 4. CBR Engine