Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- FiveWin 1.9.2 - January 97 - <b>what is an object</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 What is an Object
--------------------------------------------------------------------------------

  From the moment a human is born, they start recognizing and classifying the
  world around. Our brain has the automatic mechanisms to organize our world
  into Classes.

  An Object is a collection of Data that has some typical behaviors which
  differentiate it from other kinds of Objects.

  Object :   Data + Behaviors    -->    Data + Methods

  Data:      What the Object HAS.
  Behaviors: What the Object DOES.

  Example: What is a chair ? Even a child will tell us:

  A chair has  (DATA) :

                * four legs
                * a certain color
                * some dimensions
                * some weight
                * a surface to sit on
                * etc...

  A chair's Behaviors (METHODS) :

                * Can be built
                * Can be moved from one place to another
                * Supports someone if he/she sits on it
                * Can be destroyed
                * etc...

  In these behaviors we see what the chair DOES and what can
  be DONE TO the chair:

         The chair does:     * Supports someone if he/she sits on it

         Someone may destroy the chair  --> Something is done to the
         chair.

  The actions that get DONE TO an Object are EVENTS.

  Data:       What the Object HAS.
  Behaviors:  What the Object DOES.
  Events:     What is DONE to the Object.

  Now lets see how we take those concepts into programming languages:

  What is a Window ?

      A Window is an Object that HAS:
         * Coordinates on the screen.
         * A caption
         * Some controls on its surface
         * A color
         * etc...

      A Window DOES:
         * Resize
         * Iconize
         * Change its position
         * etc...

      Some EVENTS may happen to a Window:
         * The mouse Clicks on it
         * The user presses a key
         * The Window gets resized
         * etc...

  How can we get a certain action from an Object ?

  Send it a Message!

  oWindow:Message( params,... )

  A message usually has the same name of the Method:

  oWindow:Refresh()    ---> Will execute ---> METHOD Refresh() CLASS TWindow


Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson