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 (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 :
Theses
Complete list of metadatas

https://hal.inria.fr/tel-01651738
Contributor : Marco Naddeo <>
Submitted on : Friday, September 28, 2018 - 4:44:41 PM
Last modification on : Friday, March 22, 2019 - 1:36:46 AM

File

NaddeoPhDthesis_revised_new.pd...
Files produced by the author(s)

Identifiers

  • HAL Id : tel-01651738, version 2

Citation

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⟩

Share

Metrics

Record views

83

Files downloads

97