Learning to Spot and Refactor Inconsistent Method Names

  • Kui Liu
  • , Dongsun Kim
  • , Tegawende F. Bissyande
  • , Taeyoung Kim
  • , Kisub Kim
  • , Anil Koyuncu
  • , Suntae Kim
  • , Yves Le Traon

    Research output: Contribution to conferenceConference paperpeer-review

    Abstract

    To ensure code readability and facilitate software maintenance, program methods must be named properly. In particular, method names must be consistent with the corresponding method implementations. Debugging method names remains an important topic in the literature, where various approaches analyze commonalities among method names in a large dataset to detect inconsistent method names and suggest better ones. We note that the state-of-the-art does not analyze the implemented code itself to assess consistency. We thus propose a novel automated approach to debugging method names based on the analysis of consistency between method names and method code. The approach leverages deep feature representation techniques adapted to the nature of each artifact. Experimental results on over 2.1 million Java methods show that we can achieve up to 15 percentage points improvement over the state-of-the-art, establishing a record performance of 67.9% F1- measure in identifying inconsistent method names. We further demonstrate that our approach yields up to 25% accuracy in suggesting full names, while the state-of-the-art lags far behind at 1.1% accuracy. Finally, we report on our success in fixing 66 inconsistent method names in a live study on projects in the wild.

    Original languageEnglish
    Title of host publicationProceedings - 2019 IEEE/ACM 41st International Conference on Software Engineering, ICSE 2019
    PublisherIEEE Computer Society
    Pages1-12
    Number of pages12
    ISBN (Electronic)9781728108698
    DOIs
    StatePublished - 2019.05
    Event41st IEEE/ACM International Conference on Software Engineering, ICSE 2019 - Montreal, Canada
    Duration: 2019.05.252019.05.31

    Publication series

    NameProceedings - International Conference on Software Engineering
    Volume2019-May
    ISSN (Print)0270-5257

    Conference

    Conference41st IEEE/ACM International Conference on Software Engineering, ICSE 2019
    Country/TerritoryCanada
    CityMontreal
    Period19.05.2519.05.31

    Keywords

    • code embedding
    • Code refactoring
    • deep neural networks
    • inconsistent method names

    Fingerprint

    Dive into the research topics of 'Learning to Spot and Refactor Inconsistent Method Names'. Together they form a unique fingerprint.

    Cite this