From: "Morris, Chris" Date: 2001-12-14T01:44:53+09:00 Subject: [ruby-talk:28419] Ruby is cool (adding methods to base classes) Just had to share my current Ruby is cool moment. I needed some funky processing of array data and was about to create the following method: isArrayOrderedSuchNSuch(array, param, paramb) ... then thought, drag, I'll have 5 of these, it's stupid to have to pass array into each one of them. So, I'll make an analytical object that takes the array in the constructor Why not make a subclassed object? That'd be better. That way in my analyzing object I won't have lots of @array. floating around. But wait, why subclass ... I only need these methods for a work script, why just tack them on the existing Array class? Simple - done. Cool. It reminds of working in Delphi and having to deal with all of the stuff I can't touch in their library code. Subclassing has limitations depending on how the superclass was written (private/protected/blah). If you need to work around a glitch, you've got source so you can rebuild the library (woo-hoo!), but then there's this weighty permanance - I've modified the Vcl, remember it won't work on other developer's machines until they put in the fix as well. Funny -- I loved Delphi because it let me get down where VB never let me even see before. Now I'm complaining about its limitations . Chris