The role of constructors in the context of refactoring object-oriented systems

被引:12
|
作者
Najjar, R [1 ]
Counsell, S [1 ]
Loizou, G [1 ]
Mannock, K [1 ]
机构
[1] Univ London Birkbeck Coll, Dept Comp Sci, London WC1E 7HX, England
关键词
D O I
10.1109/CSMR.2003.1192418
中图分类号
TP [自动化技术、计算机技术];
学科分类号
0812 ;
摘要
Constructors play an essential role in object-oriented (00) languages as a means of object creation. Yet, very little empirical evidence exists on constructors, trends in their composition and how they impact comprehension and encapsulation of 00 classes. In this paper, we empirically investigate the opportunities, benefits and problems of refactoring class constructors across a sample of classes from five Java systems. The refactoring used, namely, replacing multiple constructors with creation methods, was applied to each of a set of classes containing three or more constructors. Empirical results showed benefits in terms of removed (duplicated) lines of code across the majority of systems. They also showed the potential for improved class comprehension by the creation of non-constructor methods (as a replacement for constructors) and improved encapsulation of class elements through use of a private catch-all constructor. We also provide evidence from five C++ systems which suggests similar trends in constructors to those found for Java. In terms of problems encountered, frequent and inconsistent use of the super construct made refactoring prohibitively difficult in some cases; the existence of Java interfaces also means a lack of scope for constructor refactoring. The results indicate clear and tangible benefits to be gained from investigation and implementation of refactoring techniques in Java, but with caution being exercised in certain cases; refactoring in practice is not as straightforward as the theory suggests.
引用
收藏
页码:111 / 120
页数:10
相关论文
共 50 条
  • [1] Automating object-oriented software refactoring
    Shankar, S
    Xu, XW
    SERP'03: PROCEEDINGS OF THE INTERNATIONAL CONFERENCE ON SOFTWARE ENGINEERING RESEARCH AND PRACTICE, VOLS 1 AND 2, 2003, : 561 - 567
  • [2] Analysis of Refactoring Effect on Software Quality of Object-Oriented Systems
    Malhotra, Ruchika
    Jain, Juhi
    INTERNATIONAL CONFERENCE ON INNOVATIVE COMPUTING AND COMMUNICATIONS, VOL 2, 2019, 56 : 197 - 212
  • [3] Optimized Refactoring Mechanisms to Improve Quality Characteristics in Object-Oriented Systems
    Almogahed, Abdullah
    Mahdin, Hairulnizam
    Omar, Mazni
    Zakaria, Nur Haryani
    Muhammad, Ghulam
    Ali, Zulfiqar
    IEEE ACCESS, 2023, 11 : 99143 - 99158
  • [4] Refactoring object-oriented specifications with data and processes
    Ruhroth, Thomas
    Wehrheim, Heike
    FORMAL METHODS FOR OPEN OBJECT-BASED DISTRIBUTED SYSTEMS, PROCEEDINGS, 2007, 4468 : 236 - +
  • [5] Adaptation of a Refactoring DSL for the Object-Oriented Paradigm
    Nemeth, David J.
    Horpacsi, Daniel
    Tejfel, Mate
    ACTA CYBERNETICA, 2022, 25 (04): : 817 - 846
  • [6] Correlation between Object-Oriented Metrics and Refactoring
    Boshnakoska, Daniela
    Misev, Anastas
    ICT INNOVATIONS 2010, 2011, 83 : 226 - +
  • [7] Object-Oriented Refactoring of Existing Immune Models
    Bersini, Hugues
    ARTIFICIAL IMMUNE SYSTEMS, PROCEEDINGS, 2009, 5666 : 27 - 40
  • [8] Context-driven testing of object-oriented systems
    Souter, AL
    INTERNATIONAL CONFERENCE ON SOFTWARE MAINTENANCE, PROCEEDINGS, 2003, : 281 - 284
  • [9] OBJECT-ORIENTED SYSTEMS
    COOK, S
    COMPUTER JOURNAL, 1989, 32 (04): : 289 - 289
  • [10] OBJECT-ORIENTED SYSTEMS
    HOPKINS, TP
    SOFTWARE ENGINEERING JOURNAL, 1992, 7 (02): : 82 - 83