Chapter 1

Introduction

 

The development of computer science with its new hard- and software technologies in the past couple of years has left many people unemployed. Many of the traditional former occupations have been completely or partially replaced by computers or automated programs. The number of existing programs is significant and grows extremely quickly. The problems which developers encounter and need to solve during the design and maintenance of different software can be very similar. Over the past few years, software developers have started to collect ideas for solutions which can be applied in specific design situations. Referred to as “Design patterns”, these solutions are producing a growing collection of techniques which enable and increase the speed of software development. Especially within the area of object-oriented software develop- ment has the re-use of existing software design become very important. This can be taken farther. This master´s  thesis examines the following question:

 

“Why re-use the design of  software if we can re-use the software?!”

 

The goal of this research is to design and describe the implementation of a tool which performs automatic program transformations, and most significantly, which will support software  developers in refactoring (transforming) their programs.

 

Refactorings are changes made to the program source code without changing its observable behavior. The design patterns provide targets for refactorings. The automatic source-code transformation will help to apply the design pattern to existing programs. It will increase the speed of refactoring and will allow programmers to make their software more flexible, more extendible, and easier to reuse.

 

The design of a catalog for code-transformations is the main concern of this research. The catalog should include simple transformations (such as create/move a program entity) and the base transformations (such as create factory class, specialize/generalize a class). The tool should give the user (programmer) the possibility to create new more complex transformations as a composition of existing transformations.

 

The focus of this work is not meant to create a catalog of all possible transformations or to prove the correctness of those transformations, but this research is concerned with refactoring tools from the potential users(programmers) perspective. It tries to select useful transformations which could really reduce costs of  software development.

 

This thesis describes the principles of refactorings and the design of a tool for program transformations. Chapter two(motivation) gives an example for the refactoring of a program by applying the “abstract factory” pattern to an existing program. Chapter three defines the refactoring and the transformation as an implementation of a refactoring. Chapter four introduces the criteria for the design of the refactoring catalog and describes the implemented transformations. The design and implementation issues are introduced in chapter five. The conclusion of this paper(chapter six) discusses the pros and cons of the automatic source code transformation and the future of  refactorings.