On Sun, 21 Jan 2001, Christian wrote: > To say that I have reservations about OO is an understatement. I've seen > (and built) too many rigid, awkward, inappropriate, and limiting class > hierarchies to think otherwise. The notion of a virtual method is required > but is very very much overused. Has-a is stronger than is-a. I agree. I've spent the last 10 years avoiding anything to do with OOP. It's over-complicated and imposes its own structure on my code, stopping me from writing things how I want to express it. The main problem was the way inheritance strung my code out, so I would end up with a class derived from another class derived from another class, then discover that I needed the information in one class to be available to another class. Modifying class structures involves so much re-writing that it just became far far too painful. Trying to get around this involved reams of kludge code that would use both types and copy from one to the other. Not really very nice. I visualise this form of code as being like mould growing on a spider web. If you need to re-arrange a bit of code, pulling on it will yank on the web, pulling all the other bits of code out of place and creating a domino effect that requires more and more re-writing. If I'd gotten the structure right, it would have been great code. I always get it wrong. It's that God's eye view thing again. The lack of static typing totally changes the picture. OOP just becomes a way to have private namespaces. Communication occurs between methods, not along type boundaries. I can organise my code the way I want, as everything's just a function call. Objects are just namespace context. I visualise this as being clumps of code floating around, which I can pick up, move around, create associations, and do pretty much anything without disturbing any other code. If I modify an object, then of course I have to change the code that required the old behaviour, but at least it's a direct correlation without any cascading changes. Ruby's form of OOP is very different to other forms of OOP in practice, though the theoretical basis is the same. You'll have to try it out to really see what I'm talking about, but you won't get it if you copy C++ structures in Ruby. You need to grok Ruby on its own terms, rather than viewing it as a cut down version of C++. -- steve / deaf.org