Sylvain Joyeux schrieb:
> Are you suggesting that everywhere I write a subclass I should have the 
> same initialize than the parent class ? Sounds not very useful to me.

See http://en.wikipedia.org/wiki/Liskov_substitution_principle for a 
short definition. According to this principle, the subclass doesn't have 
to have exactly the same initialize as the parent class, but it has to 
support at least the same interface. For example, if the parent class 
defines an initialize with two parameters

   def ParentClass.initialize( a, b )

then the following definitions wouldn't be allowed according to the LSP:

   def ClientClass.initialize( a )
   def ClientClass.initialize( a, b, c )

because they don't allow to call initialize with two parameters. The 
following definitions would be legal though, as they still accept the 
original form with two parameters:

   def ClientClass.initialize( a, b = nil )
   def ClientClass.initialize( *args )

Of course you're not forced to comply with the LSP, but I think it can 
help to decide when to use inheritance and when not. You can also look 
at http://c2.com/cgi/wiki?LiskovSubstitutionPrinciple for a more 
controversial discussion.

Regards,
Pit