A Modular Approach to Object Initialization for Pharo

Marco Naddeo 1, 2
2 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 (CRIStAL) - 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 metadatas

Cited literature [20 references]  Display  Hide  Download

Contributor : Marco Naddeo <>
Submitted on : Wednesday, November 29, 2017 - 1:03:45 PM
Last modification on : Thursday, March 21, 2019 - 2:50:31 PM


Files produced by the author(s)


  • HAL Id : tel-01651738, version 1


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-01651738v1⟩



Record views


Files downloads