Since the nineties, design patterns are of interest. Since the beginning of this century, research is done to the possibilities of recognizing design patterns in source code. There is little research to recognizing design patterns in UML diagrams and possibilities to provide feedback on those designs. This has led to the following research question: Are design patterns in a UML class diagram automatically detectable, and can one automatically supply some feedback? The research question is answered by a literature review followed by creating and testing a prototype, which recognizes design patterns and provides some feedback. In literature UML class diagrams and design patterns are modelled using matrices, decision trees, boolean expressions, Prolog clauses and 4-tuples. Dong describes a method, by which the various types of relationship can be denoted in one matrix. In his article, however, there is no description of the algorithm by which a design pattern can be detected. Unsuccessfully attempt has been made to write a detection algorithm by applying the steepest descent method and Richardson iteration to the method of Dong. Next, four methods for detecting design patterns are compared. The corresponding articles, including the article of Ba-Brahem, contain no description of an algorithm by which design patterns can be detected. The method of Ba-Brahem, which is based on the use of 4-tuples, seemed most promising. This method also offers the possibility to detect design patterns, which are only partially present. It can also be used to give feedback on missing relationships. For the method of Ba-Brahem I have designed and implemented an algorithm, which is able to detect design patterns. The prototype, which implements the method of Ba-Brahem, is able to detect 17 of the 23 Gang of Four patterns. Within one second 13 different design patterns are detected in a class diagram, which contains 57 classes en 61 relationships. In a second experiment a class diagram represented by a XMI files, which contains 33 classes and 49 associations, was used. The XMI file orginates from ArgoUML. This tool is used to design class diagrams. Within one second 17 different design patterns were detected. The prototype is also able to detect design patterns, which are partially present in a class diagram. When a class diagram includes a number of classes and interfaces, which forma design pattern, feedback is specified about the relationships between these classes and interfaces, which are not part of the design pattern. The prototype has made it clear, that instead of a 4-tuple a 3-tuple can be used. One of the attributes of a 4-tuple is intended to indicate whether a class has a self-reference. However, this attribute provides no contribution for the recognition of the Singleton design pattern. An essential characteristic is a self-reference of an object and not a self-reference of a class. The prototype is compared with four programs, which are described in literature. Only one program provides feedback, which is more comprehensive than the feedback from my prototype. Two programs have a graphical user interface, which displays the detected design patterns. How a design patterns is read, is either not disclosed or less simple compared to my prototype. For other issues, such as recall, precision and performance, the score of my prototype is at least equal. The Open University considers to make my prototype user friendly, such that it can be used for educational purposes.
- Master Software Engineering