Zouplaz wrote:
> Hello, when I compare Ruby to Java there is something I don't understand  .
>
> For example, let say that I create instances of JDBCFooBaseDriver in
> Java - The methods and their behaviors will never change, unless I
> update JDBCFooBaseDriver jar file. I can be sure that this part of my
> environment will stay the same even if new third party libraries are
> added and used by my application.
>
> Now, in Ruby I can use a new library (FancyDates) that will alter the
> behavior of some JDBCFooBaseDriver methods - Some methods of
> JDBCFooBaseDriver will be redefined by FancyDates and new methods will
> be added - All this stuff will occurs without giving me a chance to be
> informed of what is going on under the scene.
>
> So,
>
> 1) Is what I say right ?
> 2) Why should I not be scared by that ?
> 3) Why most C#, Java, C++ developper thinks that this approach is
> dangerous and lead to bad practices ?

You are correct and your worry is not uncommon. And yes, it does _seem_
scary. But in practice it turns out not to be such a problem. Most
C/Java programmers don't know this simply b/c they can't do it. With a
bit of good sense, open classes can be a great productivity booster.
The reason for this are suprisingly simple. As with any library you
dont use it unless a) you need it and b) you know what it does. Combine
that with unit testing and there's no need to be so worried.

Also, it's generally accepted practice not to alter pre-existing
methods, and instead add new ones if you need additional functionality
(though there are execptions of course).

T.