Skip to Main content Skip to Navigation

A Modular Approach to Object Initialization for Pharo

Marco Naddeo 1, 2 
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 : Code modularity is important for code reuse. Language designers mainly focused on method code modularity. On the contrary, initialization code modularity has usually been neglected. The initialization code of many class-based object-oriented languages becomes cumbersome in different situations: for example, when some fields have multiple initialization options (e.g., a rectangle can be positioned by providing Cartesian or polar coordinates), have optional initialization (e.g., a rectangle can be positioned in the origin (0,0) if no other coordinates are provided), or have superclass initialization (e.g., a colored rectangle must redefine all the constructors of its rectangle superclass to add the notion of color). In such cases, the number of constructors increases exponentially in the size of the initialization options, since the initialization approach lacks modularity. We propose a novel approach to field initialization, inspired by the prototypical language Magda. This approach is based on easy-to-compose initialization modules, which result to be smaller compared to classical constructors. Moreover, their number grows linearly in the size of the initialization options. We apply such approach to Pharo, a dynamically-typed object-oriented programming language inspired by Smalltalk. The adaptation to Pharo of Magda’s initialization approach implies solving some new challenges related to moving from a statically typed context to a dynamically typed one.
Document type :
Complete list of metadata

Cited literature [24 references]  Display  Hide  Download
Contributor : Marco Naddeo Connect in order to contact the contributor
Submitted on : Friday, September 28, 2018 - 4:44:41 PM
Last modification on : Wednesday, March 23, 2022 - 3:51:22 PM


Files produced by the author(s)


  • HAL Id : tel-01651738, version 2


Marco Naddeo. A Modular Approach to Object Initialization for Pharo. Programming Languages [cs.PL]. Dipartimento di Informatica, Università degli Studi di Torino; Inria Lille Nord Europe - Laboratoire CRIStAL - Université de Lille, 2017. English. ⟨tel-01651738v2⟩



Record views


Files downloads