On 20 Nov 2008, at 23:46, Roger Pack wrote:
>>> Why is the constructor method named initialize? Why not name it new
>>> to be
>>> consistent?
>> Typically, :new is a class method, which calls the instantiated
>> object's :initialize instance method, if one is available, with the
>> parameters passed to :new.
>> You can override the class method :new (this is a good place to use
>> super), but be sure to return the newly minted object.  Often you can
>> just override the :initialize instance method, however.
>>
>> If there's no :new class method in your class definition, then you're
>> getting Object.new (or some other super class's :new).
>
> Would it be better to have initialize called 'on_new' so that the
> connection is more firm?
> Thoughts?

Unfortunately :on_new assumes that :initialize is only ever called  
from :new, which isn't always the case.


Ellie

Eleanor McHugh
Games With Brains
http://slides.games-with-brains.net
----
raise ArgumentError unless @reality.responds_to? :reason