Pattern and Spoiled Pattern Detection through an Information Retrieval Approach Nadia Bouassida Institut Supérieur d’Informatique et de Multimédia Université de Sfax, Tunisie Email: Nadia.Bouassida @isimsf.rnu.tn Hanêne Ben-Abdallah Faculté des Sciences Economiques et de Gestion Université de Sfax, Tunisie Email:Hanene.BenAbdallah@fsegs.rnu.tn AbstractDesign patterns provide for a higher software quality and a reduced development cost. However, to reach these benefits, designers are expected to have a good understanding and experience with design patterns, which is not evident to acquire. Another way to benefit from design patterns is by assisting designers in their detection/identification within a given design in order to improve it. Since the exact structural instantiation of a pattern is less frequent to find within a design, the identification process should account for variations of the design with respect to the pattern. It assists the designer by showing the pattern elements in terms of the design which can be validated with respect to the classes, attributes, methods and relations of the pattern: the designer can add/remove some elements from the design in order to ensure a good instantiation of the identified pattern. However, not all structural variations of a pattern are tolerated; in fact, some variations may result in non-optimal instantiations of the pattern, a.k.a. spoiled patterns. In this case, the identification process can assist the designer by proposing corrections for an acceptable pattern instantiation. Within this design context, we propose a method that identifies design patterns and spoiled patterns through an XML document retrieval approach. This latter provides for the possibility of tolerating structural variations between the design and the searched pattern. In addition, our pattern identification method can be parameterized in order to delimit the degree of acceptable variations. Index TermsDesign pattern identification, pattern instantiation, XML document retrieval. I. INTRODUCTION Design patterns [9] are generic solutions for often occurring problems. Being proven solutions, proposed by experts, they promise several reuse benefits, such as high quality software, faster and lower cost software development. However, to attain these benefits, a designer must overcome the difficulties inherent to first understanding and then applying design patterns. In fact, even an experienced designer would spend a considerable time understanding, identifying and instantiating/reusing design patterns pertinent to his/her applications. A straight forward way to benefit fully from design patterns is to assist an inexperienced designer to improve his/her design by identifying, in the design, instantiations of design patterns. On the other hand, since exact instantiations of a design pattern is less frequent (and is less problematic), an exact pattern identification method is, therefore, of limited use. Instead, pattern identification should look for structures that “resemble” a design pattern. By resembling, we mean structures that vary from a design pattern by adding/removing some elements (classes, attributes, methods, relations). The pattern identification method can, in this case, assist the designer in restructuring his/her design in conformance with the pattern found. However, while tolerating pattern instantiations with variations, the identification method should watch out for non-tolerated variations, and in particular spoiled patterns. A spoiled pattern is a structure that allows to instantiate inadequate solutions for a given problem, where requirements are respected but architecture is improvable [17]. As an example of a spoiled pattern, an observer pattern where observers are subclasses of the subject class, a composite pattern where the leaf classes do not inherit from the composite class but are connected to the composite by a composition relation. To offer assistance through pattern identification, several approaches propose to determine the potential similarities of the structure, the class names and/or method names between the design and a given pattern. These approaches differ mainly in the pattern concepts they consider (i.e., only the structure, the structure and the methods) and the degree of structural discordance they tolerate: exact match [4] or partial match [6], [13]. All methods that tolerate structural discordance between the design and a pattern treat all pattern elements equally. However, while some elements can be deleted in a design resembling a pattern, others representing the essence of the pattern (its core) should not; otherwise the pattern would be lost and/or spoiled. In this paper, we present a new pattern identification technique that can: 1) be used to identify the structure, class names and participant roles of the pattern, 2) JOURNAL OF EMERGING TECHNOLOGIES IN WEB INTELLIGENCE, VOL. 2, NO. 3, AUGUST 2010 167 © 2010 ACADEMY PUBLISHER doi:10.4304/jetwi.2.3.167-175