Moose - A Language-Independent Reengineering Environment
by Oscar Nierstrasz and Stéphane Ducasse
Aging software systems are difficult and expensive to maintain. Moose is a language-independent environment that supports a wide range of tools to visualise, analyse and manipulate complex software systems.
Successful software systems are continually being adapted to meet evolving requirements. Unfortunately, the consequent software changes inevitably lead to a degradation in software quality, as the new requirements are divergent from the original design. As software systems age, they consequently become more complex, and thus harder to understand and maintain. A legacy software system is a system that has an undeniable business value, but has become difficult to extend and maintain.
Reengineering is the process of transforming an existing software system into a new form that can then be adapted to new purposes. The reengineering process generally entails the activities of analysing the system to extract and understand its design, assessing the problems, and migrating the system to new or transformed designs and implementations. This process is iterative, and can benefit greatly from tools to support the software engineer in manipulating, navigating and analysing models of software.
|Figure 1: The reengineering process.
Moose is a language-independent environment for representing software models. Software source code written in different programming languages can be parsed using various third-party tools, and imported into Moose by means of the CDIF or XMI exchange formats. The Moose repository then represents these models using a language-independent source-code meta-model called FAMIX. Moose offers a set of services for navigating and manipulating multiple software model versions, thus offering an infrastructure for reengineering tools to communicate and exchange information and services. Individual tools are free to extend the meta-model for their own purposes. We will briefly describe three such tools: CodeCrawler, ConAn and Van.
|Figure 2: The Moose environment.
CodeCrawler is one of the key tools supported by Moose. One of the biggest problems a software engineer faces when initially encountering a complex software system is building an impression of the state of the software and important entities in the system. CodeCrawler addresses this problem by providing polymetric views simple graphical presentations of various direct software metrics. Either coarse or fine-grained views may be of interest, depending on which stage the reengineering process is being undertaken. The system complexity view, for example, displays a class hierarchy in which the shape and shading of the class boxes indicates the numbers of attributes, methods and lines of code (see Figure 3). This is especially useful for identifying unusual classes in the system, such as those with too few or too many responsibilities.
|Figure 3: Code Crawler provides graphical presentations of software metrics.
ConAn is another tool that applies Formal Concept Analysis to identify sets of entities with common properties. These sets help the software engineer to understand the source code at different levels of granularity. The entities to be considered are chosen by the software engineer. For example, when the entities represent relationships between attributes and methods within a class, then the identified concepts highlight phenomena such as splittable classes (whose methods consistently access a partition of the state), or core methods (which access the entire state). When entities are chosen to represent behavioural dependencies between classes in a hierarchy, then concepts highlight behavioural patterns, such as hook methods or repetitive code constructs that could be refactored. And when entities represent structural dependencies, then concepts tend to correspond to common coding idioms, design patterns and reuse contracts.
Van focuses on understanding software evolution by implementing a meta-model centred around the notion of history and by defining various measurements which summarise the evolution of software entities. Applications of Van include: (i) understanding which parts of the system are likely to change in the future, (ii) using time information to improve the detection of design flaws, and (iii) clustering entities that change together to detect hidden dependencies or 'bad smells' in the code.
Other tools being developed address: (i) detection of duplicated code, (ii) clustering techniques to reduce coupling and improve cohesion, (iii) analysis of maintainability to determine the ease with which a system can evolve, by detecting and tracking features and cross-cutting concerns.
The first version of Moose was developed during the FAMOOS project, 'A Framework-Based Approach for Mastering Object-Oriented Software Evolution', ESPRIT Project 21975/ Swiss BBW No. 96.0015 (Sept 1996- Dec 1999).
Current development is funded by the Swiss National Science Foundation under projects, 'Tools and Techniques for Decomposing and Composing Software', Project No. 2000-067855.02 and 'RECAST: Evolution of Object-Oriented Applications', Project No. 620-066077.
Software Composition Group, University of Bern: http://www.iam.unibe.ch/~scg
Software downloads: http://www.iam.unibe.ch/~scg/Research/Moose/index.html
Oscar Nierstrasz, Stéphane Ducasse
University of Bern/SARIT, Switzerland