Role stereotypes in software designs and their evolution
Artikel i vetenskaplig tidskrift, 2022

Role stereotypes are abstract characterisations of the responsibilities of the building blocks of software applications. The role a class plays within a software system reflects its design intention. Wirfs-Brock introduced the following six role stereotypes: Information Holder, which knows information, Structurer, which maintains object relationships, Service Provider, which offers computing services, Coordinator, which delegates tasks to others, Controller, which directs other's actions, and Interfacer, which transforms information. Knowledge about class role stereotypes can help various software development and maintenance tasks, such as program understanding, program summarisation, and quality assurance. This paper presents an automated machine learning-based approach for classifying the role-stereotype of classes in Java projects. We analyse this approach's performance against a manually labelled ground truth for three open source projects that contain 1,500+ Java classes altogether. The contributions of this paper include: (i) a machine learning (ML) approach to address the problem of automatically inferring role-stereotypes of classes in Object-Oriented Programming Languages, (ii) the manually labelled ground truth, (iii) an evaluation of the performance of the classifier, (iv) an evaluation of the generalisability of the approach, and (v) an illustration of new uses of role-stereotypes. The evaluation shows that the Random Forest algorithm yields the best classification performance. We find, however, that the performance of the ML-classifier varies a lot for different role stereotypes. In particular, its performance degrades when classifying rarer stereotypes. Among the 23 features that we study, features related to the classes’ collaboration characteristics and complexity stand out as the best discriminants of role stereotypes.

Class role-stereotypes

Design metrics

Program analysis

Machine learning classification

Software engineering


Truong Ho-Quang

Chalmers, Data- och informationsteknik, Software Engineering

Arif Nurwidyantoro

Monash University

Satrio Adi Rukmono

Institut Teknologi Bandung

Technische Universiteit Eindhoven

Michel Chaudron

Göteborgs universitet

Technische Universiteit Eindhoven

Fabian Fröding

Göteborgs universitet

Duy Nguyen Ngoc

Göteborgs universitet

Journal of Systems and Software

0164-1212 (ISSN)

Vol. 189 111296


Annan data- och informationsvetenskap


Systemvetenskap, informationssystem och informatik med samhällsvetenskaplig inriktning



Mer information

Senast uppdaterat