Skip to Main content Skip to Navigation
Conference papers

Magic Literals in Pharo

Julien Delplanque 1 Stéphane Ducasse 1 Oleksandr Zaitsev 1
1 RMOD - Analyses and Languages Constructs for Object-Oriented Application Evolution
Inria Lille - Nord Europe, CRIStAL - Centre de Recherche en Informatique, Signal et Automatique de Lille - UMR 9189
Abstract : Literals are constant values (numbers, strings, etc.) used in the source code. Magic literals are the ones used without a clear explanation of their meaning. Presence of such literals harms source code readability, decreases its modularity, and encourages code duplication. Identifying magic literals is not straightforward. A literal can be considered self-explanatory in one context and magic in another. We need a heuristic to help developers spot magic literals. In this article, we study and characterize the literals in Pharo. We implemented a heuristic to detect magic literals and integrated it as a code critic rule for System Browser and Critics Browser in Pharo 7. We run our heuristic on 112,500 Pharo methods which reported 23,292 magic literals spread across 8,986 methods. We manually validated our approach on a random subset of 100 methods and found that 62% of the reported literals in those methods are indeed magic.
Complete list of metadata

Cited literature [24 references]  Display  Hide  Download
Contributor : Lse Lse Connect in order to contact the contributor
Submitted on : Tuesday, August 13, 2019 - 1:52:33 PM
Last modification on : Friday, December 11, 2020 - 6:44:06 PM
Long-term archiving on: : Thursday, January 9, 2020 - 9:18:00 PM


Files produced by the author(s)


  • HAL Id : hal-02266137, version 1




Julien Delplanque, Stéphane Ducasse, Oleksandr Zaitsev. Magic Literals in Pharo. IWST19 - International Workshop on Smalltalk Technologies, Aug 2019, Köln, Germany. ⟨hal-02266137⟩



Record views


Files downloads