Ruby weirdness

This week I'm trying to learn some Ruby (I want to use Chef or Puppet) and this caught my attention:

"If you happen to define a method in your subclass that has the same name as a private method in the superclass, you will have inadvertently overridden the superclass's internal utility method, and this will almost certainly cause unintended behavior."

Reference: http://rubylearning.com/satishtalim/ruby_access_control.html

How can they call it encapsulation and object-oriented design? Perhaps I'm misunderstanding something, but how on earth can this be acceptable.
Now you have to look through the super class source every time it gets updated to make sure there are no conflicts with THE PRIVATE methods. Or you have to get rid of private methods for super classes and separate them into helper classes instead.

Hopefully everyone will forget about inheritance and use composition instead :-)

Comments

Popular posts from this blog

Running LXD/LXC on WSL2 with Ubuntu 20.04

Installing pikvm on raspberry pi zero 2 w