BIROn - Birkbeck Institutional Research Online

    Evaluation of the 'replace constructors with creation methods' refactoring in Java systems

    Counsell, S. and Loizou, George and Najjar, R. (2010) Evaluation of the 'replace constructors with creation methods' refactoring in Java systems. IET Software 4 (5), 318 - 333. ISSN 1751-8806.

    Full text not available from this repository.

    Abstract

    Class constructors play an indispensable role in the Java language as a mechanism for object creation. However, little empirical evidence exists on constructors, trends in their composition and how a class with too many constructors might influence its understandability by developers. Herein, the authors investigate the applicability of the `replace constructors with creation methods` (RCwCM) refactoring of Kerievsky in five Java systems. The RCwCM was manually applied to a set of classes from each of the five systems in classes containing three or more constructors. The benefits of this refactoring include improved code readability and encapsulation, program understanding and to a lesser extent possible elimination of code duplication. Within each of the five systems, evidence of scope for applying the RCwCM refactoring based on the number of classes with multiple constructors was found. However, problems were encountered that limited its application. These are the nature of inheritance and the different styles of accessing class constructors. In the former, account has to be taken of multiple dependencies if the class is not a leaf class; in the latter, the `super` construct requires careful handling. When considered against the benefits that the RCwCM provides, care needs to be exercised. As with any refactoring effort, the short and long-term benefits need to be compared with the expense outlay (developer time and effort) as well as the opportunity cost.

    Metadata

    Item Type: Article
    School: Birkbeck Faculties and Schools > Faculty of Science > School of Computing and Mathematical Sciences
    Depositing User: Sarah Hall
    Date Deposited: 18 Jul 2013 09:55
    Last Modified: 09 Aug 2023 12:33
    URI: https://eprints.bbk.ac.uk/id/eprint/7710

    Statistics

    Activity Overview
    6 month trend
    0Downloads
    6 month trend
    256Hits

    Additional statistics are available via IRStats2.

    Archive Staff Only (login required)

    Edit/View Item
    Edit/View Item