Too Cool for Internet Explorer

Tuesday, November 20, 2007

Multiple inheritance, mixins and blog resources.

Last week, I was dealing with the use of “mixins” and its impact on method overwriting and overloading.

Some research after, could summarize on this:

  1. Multiple inheritance IS NOT supported in Ruby.
  2. Ruby supports SINGLE inheritance AND “mixins”.
  3. IF you know how (that is the question) "mixins could do almost everything multiple inheritance do, without the associated drawbacks" (Matz words).
  4. Overriding or overwriting methods, for programming purposes, means the same: Change or redefine a method that already exists in the given context.
  5. In Ruby classes are always open so, methods may be added or changed.
  6. Overloading comes from languages other than Ruby. Where you can define methods with the same name but with different argument types and quantities (signatures).
  7. Ruby is an all OOP language, for example the "+" operator is a method of the "Object" class.
  8. If you overwrite a mixed-in "+" method, you could use such modified/overwritten method on the main-object (Object class).
  9. Remember: everything in Ruby is an object.

At that point, the next step was show some code examples about that, but there is a problem. It’s not easy to put code (on a presentable way) on blogs.

On most popular blogs, there are some kinds of work to do before you can put your code there.

So, I decide not to waste time on that subject, and will select a more specialized resource to put my code and reference it here.

Suggestions welcome!

1 comment:

adhiraj said...

Do give a look here:
http://adhirajrankhambe.wordpress.com/2009/01/04/a-word-about-modules-in-ruby/