Jim Weirich wrote:
> But isn't this the essence of OCP?  The ability to extend a class (open 
> for extensions) without modifying the original code? (which remains 
> closed).
> 
> -- Jim Weirich

Hi Jim,

Could be... but I guess I understood the essence of OCP to mean I can't 
modify the original *behavior*.  If I decide to change the definition of 
Time.now, I haven't modified the original library code, but I've changed 
the expected and well-documented behavior, which pragmatically is all 
that really matters.

In other words, the "open" in OCP does seem to only talk about extending 
classes; but in Ruby, since I can actually change behavior in classes 
that would normally be "closed" in, say, C# or Java, then it seems that 
the ability to open up an existing method and redefine it is, 
essentially, not obeying the laws of OCP.

And hey, don't get me wrong, I'm not saying that's bad in any way - I'm 
just trying to think through the consequences of a language like Ruby on 
my old assumptions about what an OO language really is.

Jeff
softiesonrails.com

-- 
Posted via http://www.ruby-forum.com/.