Lecture overview -- Keyboard shortcut: 'u'  Previous page: Reusability -- Keyboard shortcut: 'p'  Next page: Phenomena and Concepts [Section] -- Keyboard shortcut: 'n'  Lecture notes - all slides and notes together  slide -- Keyboard shortcut: 't'  Textbook -- Keyboard shortcut: 'v'  Help page about these notes  Alphabetic index  Course home  Page 12 : 22
Object-oriented Programming in C#
Introduction to Object-oriented Programming
Action on objects

Ask not what the system does: Ask what it does it to!
[Bertrand Meyer]
In an objected-oriented program, most actions - as carried out by operations (instance methods) - happen on objects.

  • Actions in general

    • Implemented by procedure calls

    • Often, but not always, with parameters

In non-object-oriented program, actions can happen without targeting an object. In an object-oriented program, such action can be implemented by class methods. Class methods are known as static methods in C#.

  • Actions on objects

    • Activated via messages

      • A message always has a receiving object

      • A message is similar to a procedure calls with at least one actual parameter

    • A message activates an operation (a method)

      • The receiving object locates the best suited operation as responder (method lookup)

We act on an object obj by sending messages, see here. Either an outside object sends a message m to obj, or obj sends a message to itself.

When an object receives a message, a it will attempt to find an operation which can answer the message. In some languages, the process of locating the answering operation, is non-trivial.