Editing Topic: RCR246 Project: RCR | RCRchive home

RCR 246: Rename singleton.rb

submitted by austin on Thu Apr 15 2004 06:05:34 AM -0700

Status: pending


Abstract

Rename singleton.rb to singletonpattern.rb and the module it implements from Singleton to SingletonPattern.

Problem

There is often confusion when discussing singletons, because it is not always clear when we are discussing singleton objects (class << o; end) or objects that implement the GOF Singleton pattern. This proposal is not so much about programming Ruby as programming the Ruby community. See the short discussion in RCR231.

Proposal

Rename singleton.rb to singletonpattern.rb and the module it implements from Singleton to SingletonPattern.

Alternatively, move it from singleton.rb to patterns/singleton.rb and implement the module as Patterns::Singleton (which would suggest that the third-party library Multiton would then become Patterns::Multiton and observer.rb becomes Patterns::Observer). The latter is a longer-term and more sustainable change, but is also more broad-spectrum.

Analysis

There is significant confusion between the various meanings of singleton in the Ruby community that is at odds with most other language communities. Because people are most used to hearing "singleton" refer to an implementation of the Gamma, et al. Pattern "Singleton", it is not immediately clear that "singleton" refers to the object's singleton class. This will help disambiguate discussions.

Implementation

Implemented by renaming and/or moving the singleton.rb and modifying it such that the module is either renamed or wrapped within another module, Patterns.


Back to RCRchive.


RCR Submission page and RCRchive powered by Ruby, Apache, RuWiki (modified), and RubLog