Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c++ > #121994

Re: What is OOP?

From Tim Rentsch <tr.17687@z991.linuxsc.com>
Newsgroups comp.lang.c++
Subject Re: What is OOP?
Date 2025-03-17 10:17 -0700
Organization A noiseless patient Spider
Message-ID <86h63rr2yo.fsf@linuxsc.com> (permalink)
References <d8a5a0d563f0b9b78b34711d12d4975a7941f53a.camel@gmail.com> <gog0ljdjdhdekscrcbpprte8788aerq05h@4ax.com> <OOP-20241218203833@ram.dialup.fu-berlin.de>

Show all headers | View raw


ram@zedat.fu-berlin.de (Stefan Ram) writes:

> Rosario19 <Ros@invalid.invalid> wrote or quoted:
>
>> what is oo programming?
>
>   Alan Kay coined the term, and, in 2003, I asked him:
>
> What does "object-oriented [programming]" mean to you?
>
>   . He answered in an e-mail:
>
> |OOP to me means only messaging, local retention and protection and
> |hiding of state-process, and extreme late-binding of all things.
>
>   . My personal interpretation (taking the above source and my
>   own observations into account):

I appreciate your efforts in pursuing this and in describing what
you think it all means.  I'm glad to see a discussion about OOP
that goes beyond the common misunderstandings of what is meant.

I would like to respond to your comments with my own understanding
of how Alan views these areas.  I should explain that I have talked
with (and also listened to) Alan enough so that I think I have a
pretty good understanding of what his views are here, but the
comments below are just my impression of his thoughts.

> An object is an imaginary building block that contains states
> and procedures and can only be accessed from the outside by
> sending messages.  The object decides how it reacts (within the
> scope of its specification) to a specific message.  (runtime
> model)

An object is a blob about which nothing is known except that it is
able to receive messages and act on them (which may include doing
nothing at all).

> In object-oriented programming, programs describe under which
> conditions which messages are sent to object expressions at
> runtime:  For this purpose, there is a dispatch specification
> that defines the recipient object expression and the message
> to be sent.  This dispatch definition can also be regarded as
> an expression whose value is then determined by the recipient
> object (as a type of response).  (source code model)

The key property of object-oriented programming is that sending a
message is the only way to accomplish anything.  Sending a
message may start an activity and never return, or it may finish
and return an object value, with the understanding that "object
value" always means using pointer semantics.  There are no data
values as such;  the only kinds of values in OOP are objects.

In addition to sending messages, Smalltalk has ways of using
identifiers to refer to an object, of combining or sequencing
message send constructs, and of assigning an object value (which
again uses pointer semantics) to a named object holder (some form
of identifier), but these capabilities are secondary to the key
property described in the previous paragraph.

> It must be possible to determine which object receives a
> particular message (late binding) as late as possible (i.e. at
> runtime during the evaluation of the dispatch determination):

The late binding that Alan is talking about is the binding of
messages to processing activity.  Note the contrast with calling
a function, where the binding of name to what processing is done
is static rather than deferred.

> For this purpose, the recipient object can be specified again
> in the dispatch determination itself by means of an expression
> that is only evaluated at runtime as late as possible (runtime
> polymorphism).

It's true that the returned object value of a sent message can be
used to send a further message, but that is not an occurrence of
binding.  Calling a function through a pointer-to-function relies
on information known only at runtime, but no binding is taking
place for that (except perhaps for the mapping of a variable name
to a location holding the pointer-to-function value).

>   Yes, I really think it is better to say that we send messages
>   to expressions because which object the expression represents
>   is only determined shortly beforehand and can be different
>   each time the same code is run several times.

Messages are always sent to objects, not to expressions.

Obviously determining an object value at runtime is useful, but it
isn't any different than determining any other value at runtime.
Calling a function in C that takes two arguments and returns their
sum depends on values determined at runtime, but that nothing to do
with late binding.

The key point is that, having gotten back an object, we can't do
anything with it except send it a message, and the binding of
message to what processing activity will occur always takes place
at the last possible moment.

>   But there's something else of equal importance!  It's the
>   insight by Uncle Bob (Robert C. Martin) about when procedural
>   code is better and when object-oriented code is better.
>
> |Procedural code (code using data structures) makes it easy to
> |add new functions without changing the existing data
> |structures.  OO code, on the other hand, makes it easy to add
> |new classes without changing existing functions.
> Robert C. Martin
>
> |Procedural code makes it hard to add new data structures
> |because all the functions must change.  OO code makes it hard
> |to add new functions because all the classes must change.
> Robert C. Martin

Both of these comments make the mistake of conflating OOP with
programming in languages that have classes.  That isn't what Alan
meant by object-oriented programming.  That Smalltalk has classes
is incidental to what is meant by object-oriented programming;
classes in Smalltalk are simply a way of implementing the abstract
idea of "object-oriented programming" that had started in Alan's
thinking, and actually much earlier than Smalltalk or even Simula.

Back to comp.lang.c++ | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

What is OOP? wij <wyniijj5@gmail.com> - 2024-12-02 01:17 +0800
  Re: What is OOP? Ross Finlayson <ross.a.finlayson@gmail.com> - 2024-12-01 10:43 -0800
    Re: What is OOP? Ross Finlayson <ross.a.finlayson@gmail.com> - 2024-12-01 10:49 -0800
  Re: What is OOP? Lynn McGuire <lynnmcguire5@gmail.com> - 2024-12-01 15:07 -0600
    Re: What is OOP? Ross Finlayson <ross.a.finlayson@gmail.com> - 2024-12-01 13:36 -0800
    Re: What is OOP? Bonita Montero <Bonita.Montero@gmail.com> - 2024-12-02 08:45 +0100
  Re: What is OOP? Michael S <already5chosen@yahoo.com> - 2024-12-01 23:43 +0200
    Re: What is OOP? wij <wyniijj5@gmail.com> - 2024-12-02 09:02 +0800
  Re: What is OOP? Richard Damon <richard@damon-family.org> - 2024-12-01 17:02 -0500
    Re: What is OOP? wij <wyniijj5@gmail.com> - 2024-12-02 08:57 +0800
      Re: What is OOP? Richard Damon <richard@damon-family.org> - 2024-12-02 08:42 -0500
      Re: What is OOP? Isaac Ganoung <inventor500@vivaldi.net> - 2024-12-08 17:56 +0000
        Re: What is OOP? wij <wyniijj5@gmail.com> - 2024-12-09 08:28 +0800
          Re: What is OOP? wij <wyniijj5@gmail.com> - 2024-12-09 09:27 +0800
  Re: What is OOP? "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2024-12-01 20:11 -0800
    Re: What is OOP? wij <wyniijj5@gmail.com> - 2024-12-02 16:27 +0800
      Re: What is OOP? wij <wyniijj5@gmail.com> - 2024-12-03 20:43 +0800
  Re: What is OOP? Tim Rentsch <tr.17687@z991.linuxsc.com> - 2024-12-01 20:34 -0800
    Re: What is OOP? Michael S <already5chosen@yahoo.com> - 2024-12-02 10:47 +0200
      Re: What is OOP? Tim Rentsch <tr.17687@z991.linuxsc.com> - 2024-12-15 04:24 -0800
        Re: What is OOP? Michael S <already5chosen@yahoo.com> - 2024-12-15 16:33 +0200
          Re: What is OOP? Tim Rentsch <tr.17687@z991.linuxsc.com> - 2024-12-16 23:59 -0800
    Re: What is OOP? wij <wyniijj5@gmail.com> - 2024-12-02 16:49 +0800
      Re: What is OOP? "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2024-12-02 14:59 -0800
        Re: What is OOP? wij <wyniijj5@gmail.com> - 2024-12-03 18:10 +0800
        Re: What is OOP? wij <wyniijj5@gmail.com> - 2024-12-03 18:38 +0800
          Re: What is OOP? "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2024-12-03 12:16 -0800
            Re: What is OOP? wij <wyniijj5@gmail.com> - 2024-12-04 08:44 +0800
              Re: What is OOP? "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2024-12-06 18:16 -0800
                Re: What is OOP? wij <wyniijj5@gmail.com> - 2024-12-08 01:01 +0800
                Re: What is OOP? Ross Finlayson <ross.a.finlayson@gmail.com> - 2024-12-07 10:46 -0800
              Re: What is OOP? "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2024-12-19 21:15 -0800
                Re: What is OOP? "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2024-12-19 21:16 -0800
                Re: What is OOP? "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2024-12-19 21:17 -0800
                Re: What is OOP? "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2024-12-23 15:59 -0800
    Re: What is OOP? --- The most important aspect of OOP olcott <polcott333@gmail.com> - 2024-12-06 20:40 -0600
      Re: What is OOP? --- The most important aspect of OOP Richard Damon <richard@damon-family.org> - 2024-12-06 21:45 -0500
        Re: What is OOP? --- The most important aspect of OOP olcott <polcott333@gmail.com> - 2024-12-07 14:07 -0600
        Re: What is OOP? --- The most important aspect of OOP Tim Rentsch <tr.17687@z991.linuxsc.com> - 2024-12-09 09:51 -0800
          Re: What is OOP? --- The most important aspect of OOP Ross Finlayson <ross.a.finlayson@gmail.com> - 2024-12-09 17:43 -0800
        Re: What is OOP? --- The most important aspect of OOP Mr Flibble <leigh@i42.co.uk> - 2025-03-01 21:10 +0000
      Re: What is OOP? --- The most important aspect of OOP wij <wyniijj5@gmail.com> - 2024-12-08 00:32 +0800
  Re: What is OOP? Rosario19 <Ros@invalid.invalid> - 2024-12-04 13:14 +0100
    Re: What is OOP? wij <wyniijj5@gmail.com> - 2024-12-04 22:31 +0800
    Re: What is OOP? wij <wyniijj5@gmail.com> - 2024-12-19 10:32 +0800
    Re: What is OOP? Tim Rentsch <tr.17687@z991.linuxsc.com> - 2025-03-17 10:17 -0700
      Re: What is OOP? wij <wyniijj5@gmail.com> - 2025-03-19 04:58 +0800
        Re: What is OOP? wij <wyniijj5@gmail.com> - 2025-03-20 23:04 +0800
      Re: What is OOP? Michael S <already5chosen@yahoo.com> - 2025-03-20 17:37 +0200
        Re: What is OOP? Tim Rentsch <tr.17687@z991.linuxsc.com> - 2025-03-29 13:33 -0700
      Re: What is OOP? Mr Flibble <flibble@reddwarf.jmc.corp> - 2025-03-27 18:23 +0000
        Re: What is OOP? wij <wyniijj5@gmail.com> - 2025-03-29 11:12 +0800
          Re: What is OOP? Mr Flibble <flibble@reddwarf.jmc.corp> - 2025-03-29 05:07 +0000
          Re: What is OOP? Michael S <already5chosen@yahoo.com> - 2025-03-29 20:39 +0300
            Re: What is OOP? Mr Flibble <flibble@reddwarf.jmc.corp> - 2025-03-29 19:03 +0000
        Re: What is OOP? Tim Rentsch <tr.17687@z991.linuxsc.com> - 2025-03-29 13:36 -0700
  Re: What is OOP? wij <wyniijj5@gmail.com> - 2025-09-28 16:02 +0800

csiph-web