Picture of a sphere with binary code

Making Strathclyde research discoverable to the world...

The Strathprints institutional repository is a digital archive of University of Strathclyde research outputs. It exposes Strathclyde's world leading Open Access research to many of the world's leading resource discovery tools, and from there onto the screens of researchers around the world.

Explore Strathclyde Open Access research content

A heuristic-based approach to code-smell detection

Kirk, D. and Roper, M. and Wood, M. (2007) A heuristic-based approach to code-smell detection. In: 1st workshop on refactoring tools (WRT'07) proceedings. Nova Science Publishers, Inc., pp. 54-56.

[img]
Preview
PDF
WRT_Proceedings.pdf - Published Version

Download (3MB) | Preview

Abstract

Encapsulation and data hiding are central tenets of the object oriented paradigm. Deciding what data and behaviour to form into a class and where to draw the line between its public and private details can make the difference between a class that is an understandable, flexible and reusable abstraction and one which is not. This decision is a difficult one and may easily result in poor encapsulation which can then have serious implications for a number of system qualities. It is often hard to identify such encapsulation problems within large software systems until they cause a maintenance problem (which is usually too late) and attempting to perform such analysis manually can also be tedious and error prone. Two of the common encapsulation problems that can arise as a consequence of this decomposition process are data classes and god classes. Typically, these two problems occur together – data classes are lacking in functionality that has typically been sucked into an over-complicated and domineering god class. This paper describes the architecture of a tool which automatically detects data and god classes that has been developed as a plug-in for the Eclipse IDE. The technique has been evaluated in a controlled study on two large open source systems which compare the tool results to similar work by Marinescu, who employs a metrics-based approach to detecting such features. The study provides some valuable insights into the strengths and weaknesses of the two approaches