S
Shak
Hi all,
Yes, this question has been asked many times all over the Internet so I'm a
bit embarrassed to admit that I still don't know what the difference is.
Apologies in advance for making you roll your eyes.
If I have a family of classes, each with a common method etc, should I push
that common code up into a superclass or module? Right now I'm inclined to
say the latter since I'll be able to mixin further modules later on if
required. But what would a superclass in Ruby provide that a module
wouldn't? In a ducktyped world I don't see any benefits with
type-polymorphism.
Alternatively: is there any reason why we shouldn't use modules for single
inheritance (seeing as that's a special, trivial case of multiple
inheritance)?
Sorry for boring you all,
Shak
Yes, this question has been asked many times all over the Internet so I'm a
bit embarrassed to admit that I still don't know what the difference is.
Apologies in advance for making you roll your eyes.
If I have a family of classes, each with a common method etc, should I push
that common code up into a superclass or module? Right now I'm inclined to
say the latter since I'll be able to mixin further modules later on if
required. But what would a superclass in Ruby provide that a module
wouldn't? In a ducktyped world I don't see any benefits with
type-polymorphism.
Alternatively: is there any reason why we shouldn't use modules for single
inheritance (seeing as that's a special, trivial case of multiple
inheritance)?
Sorry for boring you all,
Shak