SV: [Tutor] Stuck with classes

Sean 'Shaleh' Perry shalehperry@home.com
Thu, 04 Oct 2001 13:44:00 -0700 (PDT)


On 04-Oct-2001 Danny Kohn wrote:
> Find oop somewhat complicated I must say. Obviously I can go back to
> functions but I at least I want to understand it proper so that my choice
> will not be one of ignorance.
> 
> Danny Yoo is correct in that I want to be able to have many concurrent
> instances of a matrixPanel.
> 

OOP is about thinking in terms of things interactring with each other. 
Imperative programming (C, etc) uses tools (functions) to act on the
participants without their control.

in classic imperative/C style you would have:

setupParent(parent, child1, child2)

whereas in OOP you have:

parent.setup(child1, child2)

This is what you have to wrap your head around.  OOP is all about metaphor and
using the real world to help the abstract make sense.  Look at your example. 
There is this thing called a "panel" which has certain properties and things it
knows how to do like draw itself.  By adding other objects the panel can do
other things.  So when it draws itself it then tells other attached objects to
also draw themself.  Understanding a group of classes is really about
understanding how they interact with each other.